https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114321
Bug ID: 114321 Summary: [11 regression] ipa/modref: incorrect result with O2 since r11-3308 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: yinyuefengyi at gmail dot com Target Milestone: --- https://godbolt.org/z/hz4E1q4dK Though the code is somewhat flaw, uint64_t pointer is passed to a function and modified as uint32_t pointer, the function call is removed by fre1 pass as: ipa-modref: call stmt MurmurHash3_x86_32 (_8, _2, 123456, &ret); ipa-modref: call to void MurmurHash3_x86_32(const void*, int, uint32_t, uint64_t*)/554 does not clobber ref: ret alias sets: 46->46 Setting value number of _10 to 0 (changed) Value numbering stmt = ret ={v} {CLOBBER(eol)}; Setting value number of .MEM_11 to .MEM_11 (changed) Value numbering stmt = return _10; marking outgoing edge 2 -> 1 executable RPO iteration over 1 blocks visited 1 blocks in total discovering 1 executable blocks iterating 1.0 times, a block was visited max. 1 times RPO tracked 9 values available at 3 locations and 9 lattice elements Replaced MEM[(const struct basic_string *)trace_id_6(D)]._M_dataplus._M_p with _7 in all uses of _8 = MEM[(const struct basic_string *)trace_id_6(D)]._M_dataplus._M_p; Replaced ret with 0 in all uses of _10 = ret; Removing dead stmt _10 = ret; Removing dead stmt _8 = MEM[(const struct basic_string *)trace_id_6(D)]._M_dataplus._M_p; Not sure whether this is valid, it works before gcc11. Disable with -fno-ipa-modref or -fno-strict-aliasing could work. Please take a look?