https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109967
Davin McCall <davmac at davmac dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |davmac at davmac dot org --- Comment #3 from Davin McCall <davmac at davmac dot org> --- -fdisable-tree-cunroll avoids it. This is the take of someone who is new to poking GCC internals, so take this with a grain of salt, but: It looks like cunroll duplicates (partially unrolls, I suppose) the inner loop, meaning that `g' is live in two disjoint ranges, with a CLOBBER between them. Then later passes (fre5, but disabling it doesn't seem to help) recognise that &g and &g are the same in both ranges and so use a single temporary for both. This confuses cfgexpand (as Andrew Pinski notes) because the memory dereference of the temporary isn't seen as an access of g (in add_scope_conflicts()/add_scope_conflicts_1()/visit_conflict()). I don't understand the IR semantics well enough to know the right fix - perhaps cunroll should be removing the clobber (does a clobber affect storage lifetime or only value?), or perhaps cfgexpand should be more conservative when it sees a memory access.