https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120987
--- Comment #41 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:ba41db3419583df8ff148f2d20ca48c2aa4b5e98 commit r13-10365-gba41db3419583df8ff148f2d20ca48c2aa4b5e98 Author: Jan Hubicka <[email protected]> Date: Tue Mar 10 07:56:23 2026 +0100 Fix merging of flags in ipa_merge_modref_summary_after_inlining When merging the modref summary after inlining, we merge all of the flags of the outer functions that was inlined into. But things go wrong as now the flags includes both ECF_NORETURN and ECF_NOTHROW. This happens because the function which was being inlined had ECF_NOTHROW while caller had ECF_NORETURN. When both of these are set, ignore_stores_p and ignore_nondeterminism_p return true. But in this case the inner function is still just nothrow and not noreturn. Originally the code was written to only merge ECF_PURE and ECF_CONST where this logic is correct. This fixes merigng of ignore_stores and ECF_LOOPING_CONST_OR_PURE flags. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/120987 gcc/ChangeLog: * ipa-modref.cc (ipa_merge_modref_summary_after_inlining): Mask off non const/pure/novops related flags when combining of outer functions. gcc/testsuite/ChangeLog: * g++.dg/torture/pr120987-1.C: New test. Co-authored-by: Andrew Pinski <[email protected]> (cherry picked from commit 27b4500ec3f97e0e8da9949b352a32147af8edf5)
