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] | |
On Thu, 26 Aug 2004, Roland Dreier wrote:
> 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
uint64_t is unsigned long rather than unsigned long long on those 64-bit
targets. Thus the pointer cast creates a pointer which foo cannot safely
dereference without converting back to a pointer to uint64_t.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |