https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93156
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to jim from comment #5) > (In reply to Andrew Pinski from comment #4) > > (In reply to jim from comment #3) > > > 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? > > > > It is not that null_ptr can result in -1 directly but rather if it is > > inlined and then later on passed to a non-null function, it will change it > > to be the non-null case. > > Let me rephrase: how can a transformation that makes it look like null_ptr > returned -1 be valid? Because it would be undefined code if it returned NULL. That is: a?-1:0 is transformed into -1 before we figure out that a is always true; an ordering difference.