Bug in loop optimize (TREE stage)

Denis Chertykov denisc@overta.ru
Tue Dec 26 12:05:00 GMT 2000


"Alexander Popov" <sasho@vip.orbitel.bg> have founded a bug in generic
GCC code.
I have tried  avr and x86 ports.

The XXX.rtl file already have a bug.


volatile unsigned char *p;
volatile unsigned char i;

int main(void) {

   do {
   	i++;
   } while(p++<(unsigned char *)0xffffffff);
  /* if 0xffffffff change to 0xfffffffe then no bug */
   return 0;
}

Latest CVS GCC (i586-linux-gcc) generates:

	.file	"stdin"
	.version	"01.01"
gcc2_compiled.:
	.text
	.align 16
.globl main
	.type	main,@function
main:
	movb	i, %al
	pushl	%ebp
	incl	%eax
	movl	%esp, %ebp
	incl	p
	movb	%al, i
	xorl	%eax, %eax
	popl	%ebp
	ret
.Lfe1:
	.size	main,.Lfe1-main
	.comm	p,4,4
	.comm	i,1,1
	.ident	"GCC: (GNU) 2.97 20001226 (experimental)"




Denis.



More information about the Gcc mailing list