https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93940
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org, | |jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This happens in edge_set_predicate: 271 if (predicate && *predicate == false 272 /* When handling speculative edges, we need to do the redirection 273 just once. Do it always on the direct edge, so we do not 274 attempt to resolve speculation while duplicating the edge. */ 275 && (!e->speculative || e->callee)) 276 e = redirect_to_unreachable (e); I bet the inliner assumes that __builtin_constant_p will evaluate to true, D.2273.b = 0; k = D.2273; ... _8 = k.b; _9 = __builtin_constant_p (_8); but while fre3 with -O2 propagates the 0 into __builtin_constant_p and folds it to 1, with -Og we do fewer optimizations and don't propagate the constant to it. With -O2 -fno-tree-fre it will fail the same way.