Incorrect loop generation code generated by gcc-2.95.2 configured for PPC target (powerpc-rtems) (extracted directly from cvs the 21/10/99)
Jeffrey A Law
Sun Oct 31 23:03:00 GMT 1999
In message < 3811D4C2.29112F1C@fnac.net >you write:
> This is a multi-part message in MIME format.
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> This bug is present in gcc-2.95.1 and in the gcc snapshot extracted the
> 21 th October from CVS with the correct gcc-2.95.2 branch tag.
> Attached with this mail you will find :
> 1) The C code that triggers the bug (standalone so that you can
> regenerate it)
> 2) The side by side asm code generated by egcc 1.1.2 (-mcpu=604) and
> gcc-2.95.2 (-mcpu=750) (and probably gcc-2.95.1 as the bug also happens
> with this gcc version)
> 3) The explanation of the bug in the form of commented asm,
> Basically the bug is due to the new way used to generate C "for"
> instruction. Now for the PPC targets the PPC' "CTR" register is used in
> cunjunction of the "bdnz". The problem is that the CTR register is
> automatically decremented by the bdnz instruction but the CTR value is
> not always used as the input value for the index variable of the loop.
> See comments in the asm code.
I've got a fix for this, but I'm not sure whether or not I'm comfortable with
including it in gcc-2.95.2 this late in the process. We'll see.
More information about the Gcc-bugs