bug in current gcc-3.4 20030916

Enache Adrian enache@rdslink.ro
Sat Sep 20 13:01:00 GMT 2003


$ cat bug.c
#include <stdio.h>
int main()
{
        int hicount = 0;
        unsigned char *c;
        char *str = "\x7f\xff";
        for (c = (unsigned char *)str; *c ; c++) {
                if (!(((unsigned int)(*c)) < 0x80)) hicount++;
        }
        printf("%d\n", hicount);
	return 0;
}
$ gcc -O bug.c
$ ./a.out 
2
	<the same with -O2, -O3, etc>
$ gcc bug.c
$ ./a.out
1
	<also correct with 3.3.1, 3.2, etc>
$ gcc -v
Reading specs from /usr/y/gcc/lib/gcc/i386-unknown-freebsd5.1/3.4/specs
Configured with: '/arc/gcc/configure' '--prefix=/usr/y/gcc '--enable-languages=a
da,c,c++,f77
Thread model: posix
gcc version 3.4 20030916 (experimental)

Regards,
Adi



More information about the Gcc mailing list