------- Comment #1 from jakub at gcc dot gnu dot org  2010-05-20 13:27 -------
So, we have:
<bb 3>:
  [pr44205.c : 7:11] i.1_2 = i;
  [pr44205.c : 7:10] if (i.1_2 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  [pr44205.c : 8:4] i = 0;
  goto <bb 6>;

<bb 5>:
  [pr44205.c : 10:4] i = 1;

<bb 6>:
  goto <bb 8>;

<bb 7>:
  [pr44205.c : 13:7] i = 2;

<bb 8>:
  [pr44205.c : 14:1] return;

in *.optimized dump which roughly corresponds to the first goto after i = 0
being on line 6 and then another goto on line 8.  Then during cfgcleanup mode
the jump is forwarded and just one of the locations is kept.

Now, either we'd need for -O0 to prevent jump forwarding when the locus is
different (or add a nop with one locus followed by jump with the second locus),
which would lead to gdb seeing movl $0, i; nop; on line 8 and jmp ... on line
10 (or movl $0, i; jmp 1f; on line 8 and movl $1, i; 1: jmp 3f; on line 10.
Or we need to do something already during gimplification and for nested if/else
if if(){}else{} isn't followed by any other statement and is inside of then
block of another if, ensure the branch goes stright to the last label instead
of hopping through some pad in the middle.  Only that would ensure movl $0, i;
jmp 3f; is on line 8 and that line 14 is immediately next insn after that.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44205

Reply via email to