[egcs-19980608] Extremely serious comparison bug

Horst von Brand vonbrand@sleipnir.valparaiso.cl
Thu Jun 11 20:03:00 GMT 1998


Hyman Rosen <hymie@prolifics.com> said:
> The following code runs incorrectly and prints "FAILED!" when compiled
> with -O, -O1, or -O2 on x86 Linux.

The following simplified test case shows the same here for -O to -O3 at
least, no optimization works:

extern int printf(char *, ...);

struct fd {
	unsigned char a;
} fd = {5};


int main()
{
	struct fd *f = &fd;

	if (((f->a & 0x7f) & ~0x10) <= 2)
		printf("FAILED!\n");
	return 0;
}
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile                               +56 32 672616



More information about the Gcc-bugs mailing list