This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-fstrict-aliasing


Is GCC permitted to miscompile, with -fstrict-aliasing, source
which clearly flouts the assumptions of that option ?

eg.

#include <stdio.h>

unsigned int x, y;
float i, j;
int r;

int main()
{
	x = 0xFFFFFFFE;
	y = 0xCBFFFFFE;
	i = *(float*)&x;
	j = *(float*)&y;
	r = i<=j;
	printf("result = %d\n", r);
	return 0;
}

TIA, John Parkes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]