This is the mail archive of the gcc@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]

varargs, 64-bit targets, and strict-aliasing warnings


Can anyone explain some odd behavior seen compiling this code:

	#include <stdint.h>
	
	int foo(int a, ...);
	
	int bar(void)
	{
		uint64_t x;
		return foo(1, (unsigned long long *) &x);
	}

If I compile for a 64-bit target with "-c -fstrict-aliasing -Wall", I get:

	b.c: In function `bar':
	b.c:8: warning: dereferencing type-punned pointer will break strict-aliasing rules

I get this for x86-64, ia64, ppc64 and sparc64.

However, if I compile for a 32-bit target (I've tried i386 and ppc32)
with the same options, I get no warnings.

It seems the warning is spurious, since nothing is being type-punned
and no aliases are being created.

Thanks,
  Roland


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