Incorrect loop generation code generated by gcc-2.95.2 configured for PPC target (powerpc-rtems) (extracted directly from cvs the 21/10/99)

Valette Eric
Sat Oct 23 08:32:00 GMT 1999

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.


  /  `                   	Eric Valette
 /--   __  o _.          	Canon CRF
(___, / (_(_(__         	Rue de la touche lambert
				35517 Cesson-Sevigne  Cedex

Tel: +33 (0)2 99 87 68 91	Fax: +33 (0)2 99 84 11 30

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mail-gcc-bug2
Type: text/x-c
Size: 10459 bytes
Desc: not available
URL: <>

More information about the Gcc-bugs mailing list