------- Comment #11 from rguenth at gcc dot gnu dot org 2010-03-23 13:37 ------- Unassinging Andrew. Raising priority to P2.
At -O2 we now optimize main () to main () { <bb 2>: # DEBUG a => 2 # DEBUG b => 3 # DEBUG c => 4 # DEBUG a => 3 # DEBUG b => 4 [t.c : 13:22] printf ([t.c : 13] &[t.c : 13] "%d\n"[0], 9); [tail call] [t.c : 14:13] return; } at -O1 we get <bb 2>: # DEBUG a => 2 # DEBUG b => 3 # DEBUG c => 4 [t.c : 8:32] D.2741_4 = add2 (3, 4); [t.c : 8:15] D.2740_5 = D.2741_4 + 2; [t.c : 13:22] printf ([t.c : 13] &[t.c : 13] "%d\n"[0], D.2740_5); [t.c : 14:13] return; which seems to be close to the reported case. the + 2 has line 8 and thus is ok before TER. We still expand to (insn 12 11 13 t.c:13 (parallel [ (set (reg:SI 61) (plus:SI (reg:SI 58 [ D.2741 ]) (const_int 2 [0x2]))) (clobber (reg:CC 17 flags)) ]) -1 (nil)) (insn 13 12 14 t.c:13 (set (reg:SI 4 si) (reg:SI 61)) -1 (nil)) (insn 14 13 15 t.c:13 (set (reg:DI 5 di) (symbol_ref/f:DI ("*.LC0") [flags 0x2] <string_cst 0x7ffff5b36820>)) -1 (nil)) (insn 15 14 16 t.c:13 (set (reg:QI 0 ax) (const_int 0 [0x0])) -1 (nil)) (call_insn 16 15 0 t.c:13 (set (reg:SI 0 ax) (call (mem:QI (symbol_ref:DI ("printf") [flags 0x41] <function_decl 0x7ffff7efc000 printf>) [0 S1 A8]) (const_int 0 [0x0]))) -1 (nil) (expr_list:REG_DEP_TRUE (use (reg:QI 0 ax)) (expr_list:REG_DEP_TRUE (use (reg:DI 5 di)) thus expanding a TERd expression does not properly reset location infromation. CC'ing Micha. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|amacleod at redhat dot com |unassigned at gcc dot gnu | |dot org Status|ASSIGNED |NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19192