https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103267
--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> --- I have proposed a patch to address this issue in: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585756.html Well, it prevents the infinite loop testcase from segfaulting when the function infinite() is not declared with const attribute explicitely but it is only internally auto-discovered to be ECF_CONST. I think that is OK because explicit attribute const should guarantee no side-effects and infinite loop is IMHO one (though I have read how we document it in our manual and I am not entirely sure that is how we handle it, but IMHO the manual disallows infinite looping too). (We also discussed the post-dominance check with Honza in person and at least my impression is that the situation is not as dire as comment #9 might suggest.)