Tracking http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43150#c2 issue 2) here:
In f2 with -O2 -g -m64 we have in *.ce3 (which looks correct): (insn 2 53 3 2 vla-1.c:22 (set (reg/v:SI 41 r12 [orig:61 i ] [61]) (reg:SI 5 di [ i ])) 47 {*movsi_1} (expr_list:REG_DEAD (reg:SI 5 di [ i ]) (nil))) (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) (debug_insn 6 3 7 2 vla-1.c:23 (var_location:SI D.4294967290 (plus:SI (mult:SI (reg/v:SI 41 r12 [orig:61 i ] [61]) (const_int 2 [0x2])) (const_int 7 [0x7]))) -1 (nil)) (debug_insn 7 6 8 2 vla-1.c:23 (var_location:DI D.4294967292 (sign_extend:DI (debug_expr:SI D#6))) -1 (nil)) (debug_insn 8 7 9 2 vla-1.c:23 (var_location:DI D.4294967293 (plus:DI (debug_expr:DI D#4) (const_int -1 [0xffffffffffffffff]))) -1 (nil)) (debug_insn 9 8 10 2 vla-1.c:23 (var_location:DI D.1619 (debug_expr:DI D#3)) -1 (nil)) (note 10 9 46 2 NOTE_INSN_DELETED) (insn 46 10 12 2 vla-1.c:23 (set (reg:SI 0 ax [63]) (subreg:SI (plus:DI (mult:DI (reg:DI 41 r12 [orig:61 i ] [61]) (const_int 2 [0x2])) (const_int 7 [0x7])) 0)) 271 {*lea_1_rex64} (nil)) but then *.cprop_hardreg breaks it up: (insn 2 53 3 2 vla-1.c:22 (set (reg/v:SI 41 r12 [orig:61 i ] [61]) (reg:SI 5 di [ i ])) 47 {*movsi_1} (expr_list:REG_DEAD (reg:SI 5 di [ i ]) (nil))) (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) (debug_insn 6 3 7 2 vla-1.c:23 (var_location:SI D.4294967290 (plus:SI (mult:SI (reg:SI 5 di [orig:61 i ] [61]) (const_int 2 [0x2])) (const_int 7 [0x7]))) -1 (nil)) (debug_insn 7 6 8 2 vla-1.c:23 (var_location:DI D.4294967292 (sign_extend:DI (debug_expr:SI D#6))) -1 (nil)) (debug_insn 8 7 9 2 vla-1.c:23 (var_location:DI D.4294967293 (plus:DI (debug_expr:DI D#4) (const_int -1 [0xffffffffffffffff]))) -1 (nil)) (debug_insn 9 8 10 2 vla-1.c:23 (var_location:DI D.1619 (debug_expr:DI D#3)) -1 (nil)) (note 10 9 46 2 NOTE_INSN_DELETED) (insn 46 10 12 2 vla-1.c:23 (set (reg:SI 0 ax [63]) (subreg:SI (plus:DI (mult:DI (reg:DI 41 r12 [orig:61 i ] [61]) (const_int 2 [0x2])) (const_int 7 [0x7])) 0)) 271 {*lea_1_rex64} (nil)) (while %rdi is equal to %r12 at that point, %rdi is REG_DEAD in an earlier insn, so extending lifetime of that into a DEBUG_INSN after it leads to a resetting of debug_insn 6 during sched2. I believe we need to make sure we don't extend lifetime of hard regs in debug insns during cprop_hardreg. -- Summary: Wrong debug info in guality/vla-1.c (f2) Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43161