https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100221
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- If we force inline f: like: [[gnu::always_inline]] static inline void f() -O2 behavior becomes the same as -O3. -O3: Deleted dead store: # .MEM_7 = VDEF <.MEM_6> hD.2116[0] = &gD.2115; -O2: ipa-modref: call stmt f (); ipa-modref: call to void f()/3 does not use ref: h[0] alias sets: 3->3 Deleted dead store: # .MEM_7 = VDEF <.MEM_6> hD.2116[0] = &gD.2115; ipa-modref: call stmt f (); ipa-modref: call to void f()/3 does not use ref: g alias sets: 2->2 Deleted dead store: # .MEM_6 = VDEF <.MEM_2> gD.2115 = &_ZL1cD.2103; I don't see why there is a difference between g and h here except g had its address taken before maybe tracking MEM though the loop is what is causing the issue.