is this broken or what?

Tim Olson tim at nucleus.amd.com
Wed Jan 24 14:30:15 AEST 1990


In article <1990Jan23.155910.2439 at cubmol.bio.columbia.edu> ping at cubmol.bio.columbia.edu (Shiping Zhang) writes:
| In article <1482 at mdbs.UUCP> wsmith at mdbs.UUCP (Bill Smith) writes:
| >	unsigned u = 0;
| >
| >	if (u-- < 4)
| >		printf("yes\n");
| >	else
| >		printf("no\n");
| >
| >The Data General Aviion 5000 (an 88000 machine) version of GCC converts this 
| >into:
| >
| >	unsigned u = 0;
| >
| >	if(--u < 3) ....
| >
| >for the assembly.
| >
| 
| To me, the codes in the two cases are same.

Check out what happens when u == 0.  Yes, it is an unsafe optimization
which should not be performed.


	-- Tim Olson
	Advanced Micro Devices
	(tim at amd.com)



More information about the Comp.lang.c mailing list