https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93156
--- Comment #3 from jim at meyering dot net --- Hi Andrew, thank you for the prompt investigation. I'm probably just being dense, but how can the compiler ever generate code for that null_ptr function that results in -1? Your comment shows you know this already, but for others, here's a comment from the sources in gnulib: /* If you want to know why this always returns NULL, read https://en.wikipedia.org/wiki/Quadratic_residue#Prime_power_modulus . */ Note that at least some versions of canonicalize_file_name *can* take a NULL argument, so the use of the nonnull attribute in that declaration is wrong. I did notice that removing it in this reproducer and in the original makes the problem go away.