https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94947
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #3) > In fact this situation doesn't seem to be handled at all - global variables > are still an afterthought in IPA-PTA it seems. Needs more work than a > simple fix. Hum, actually it's a simple bug and the following fixes it. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 416a26c996c..16a2b53c2b7 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -8187,8 +8187,8 @@ ipa_pta_execute (void) /* For the purpose of IPA PTA unit-local globals are not escape points. */ - bool nonlocal_p = (var->used_from_other_partition - || var->externally_visible + bool nonlocal_p = (var->externally_visible_p () + || var->used_from_other_partition || var->force_output); var->call_for_symbol_and_aliases (refered_from_nonlocal_var, &nonlocal_p, true);