------- Additional Comments From amodra at bigpond dot net dot au  2004-10-16 10:58 
-------
Michal's reduced testcase, in comment #5, fails on powerpc-linux too.
expand_increment is expanding the inline function body twice, at line 9261
  op0 = expand_expr (incremented, NULL_RTX, VOIDmode, 0);
and at line 9353
  temp = expand_assignment (incremented, newexp, ! post && ! ignore);
Targets such as x86 don't do the second expansion, because even though "post" is
zero due to expr.c line 8774
      /* Faster to treat as pre-increment if result is not used.  */
      return expand_increment (exp, ! ignore, ignore);
"single_insn" is true.  That suggested a slight modification to Michal's
testcase might fail on x86, and indeed it does.

So it seems this bug will hit all targets.  Hopefully the clue I've given here
about multiple expansion of the inline function body will trigger an "Ah ha!"
moment in someone who knows their way around tree-inline.c.

$ gcc/xgcc -Bgcc/ -xc++ -O -DBUG -S /src/tmp/pr17972.c
$ cat pr17972.s
        .file   "pr17972.c"
        .text
        .align 2
.globl _Z2fnv
        .type   _Z2fnv, @function
_Z2fnv:
.LFB3:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
.L2:
        jmp     .L2
.LFE3:
        .size   _Z2fnv, .-_Z2fnv
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.4.3 20041015 (prerelease)"


-- 


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

Reply via email to