https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81741
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |law at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I see the same behavior with 4.9, as well as older (e.g. 4.8 or 4.4). The thing is that __builtin_constant_p is (at -O1 and above) a check whether some expression is constant after optimizations, and here FRE or DOM passes figure out (due to jump threading?) that it is constant. Abusing __builtin_constant_p this way is always going to be risky.