https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81325
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-09-11 CC| |jakub at gcc dot gnu.org, | |marxin at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Unfortunately confirmed, caused by (probably) in RTL expansion: try_optimize_cfg iteration 1 Merging block 3 into block 2... Merged blocks 2 and 3. Merged 2 and 3 without moving. Forwarding edge 17->18 to 19 failed. Where w/o -g there's no forwarding failure. The CFG diverges here: <bb 9> [53.47%] [count: INV]: # DEBUG D#8 => &g # DEBUG D#9 => D#8 # DEBUG this => D#9 # DEBUG a => 0B # DEBUG this => 0B # DEBUG D#2 => &MEM[(struct F *)0B].RefCount.D.2982 # DEBUG this => D#2 _77 = &MEM[(struct C *)0B]._M_i; __atomic_fetch_add_4 (_77, 0, 0); # DEBUG this => NULL [some # DEBUG...] # DEBUG this => D#2 __atomic_fetch_add_4 (_77, 0, 0); # DEBUG this => NULL Because __atomic_fetch_add_4 is eventually expanded as: (code_label 93 92 436 8 5 (nil) [1 uses]) (note 436 93 94 8 [bb 8] NOTE_INSN_BASIC_BLOCK) (insn 94 436 95 8 (set (reg:SI 152) (unspec_volatile:SI [ (mem/v:SI (reg/f:DI 131 [ _76 ]) [-1 S4 A128]) ] UNSPECV_LL)) "/home/marxin/Programming/testcases/pr82325.cpp":7 -1 (nil)) (insn 95 94 96 8 (set (reg:SI 153) (plus:SI (reg:SI 152) (const_int 0 [0]))) "/home/marxin/Programming/testcases/pr82325.cpp":7 -1 (nil)) (insn 96 95 97 8 (parallel [ (set (reg:CC 154) (unspec_volatile:CC [ (const_int 0 [0]) ] UNSPECV_SC)) (set (mem/v:SI (reg/f:DI 131 [ _76 ]) [-1 S4 A128]) (reg:SI 153)) ]) "/home/marxin/Programming/testcases/pr82325.cpp":7 -1 (nil)) (jump_insn 97 96 437 8 (set (pc) (if_then_else (ne (reg:CC 154) (const_int 0 [0])) (label_ref 93) (pc))) "/home/marxin/Programming/testcases/pr82325.cpp":7 -1 (int_list:REG_BR_PROB 18 (nil)) -> 93) which is a loop. Due to that a different CFG is created. And the failure 'Forwarding edge 17->18 to 19 failed.' is attempt to skip from first atomic fetch loop to another. Fails due to existence of bunch of debug statements in between. Huh, still not sure where is error, can we have one __atomic_fetch_add_4 following another? GIMPLE representation does not represent fact that's a loop code. Advice welcomed.