https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113551
--- Comment #16 from Yuxuan Shui <yshuiv7 at gmail dot com> --- (In reply to Andrew Pinski from comment #13) > (In reply to Yuxuan Shui from comment #12) >> ... > > Except that is undefined ... > Manually unswitching introduces the undefined behavior in the code. > So even though the code was unswitched before GCC 13 incorrectly, GCC didn't > take into that account before hand. > > I am 99% sure what is happening is GCC is see `if (a+1)` and then assuming a > can't be a nullptr. Which is due to undefinedness there of adding 1 to an > null ptr ... (for C that is). > > Basically the unswitch is the issue ... Or we maybe we should turn `if > (a+1)` into just `if (a)` ... Likewise for `if (&a->i)` into `if (a)` I see. but if it's undefined, why was the `if (dso)` only removed when -fno-strict-overflow is enabled? and it still happens with `-fno-delete-null-pointer-checks`