https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93156
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is not about null_ptr cannot return null. But rather canonicalize_file_name
cannot take a null pointer.
If you don't want null_ptr to be inlined into main and not optimized into -1,
then add noipa or noclone/noinline to that function.
DOM changes it:
Visiting statement:
_2 = canonicalize_file_name (_14);
Intersecting
void * [1B, +INF] EQUIVALENCES: { _14 } (1 elements)
and
void * ~[1B, -2B]
to
void * [-1B, +INF] EQUIVALENCES: { _14 } (1 elements)
pushing new range for _14: void * [-1B, +INF] EQUIVALENCES: { _14 } (1
elements)
Optimizing statement _2 = canonicalize_file_name (_14);
Replaced '_14' with constant '-1B'
Because 0 is not a valid input to canonicalize_file_name.
That is the test in gnulib is broken and undefined.