[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strict aliasing in gcc33
From: |
Pete French |
Subject: |
strict aliasing in gcc33 |
Date: |
Thu, 29 Apr 2004 15:50:55 +0100 |
This isnt really GNustep,its more of an objective C question, but I am
not sure where else to ask...
I am moving from gcc2.95 to gcc3.3 which I find is that if I compile
any code with -O2 enabled then I get the following warning when I invoke a
method:
bash-2.05b$ gcc33 -c -Wall -O2 stest.m
stest.m: In function `main':
stest.m:29: warning: dereferencing type-punned pointer will break
strict-aliasing rules
I have completely failed to find any way to code the file such that it does
not produce this warning. Obviously II can add the '-fno-strict-aliasiing' to
the cmmand line, but I do not belive that al Objectoive C needs this to
compile without warning! Surely not!
The piece of test code in question looks like this: (the error is
on the '[TestObject new]' line)
-bat.
#include <objc/objc.h>
#include <objc/objc-api.h>
#include <objc/Object.h>
#include <objc/Protocol.h>
@interface TestObject : Object
@end
@implementation TestObject : Object
+ load
{
puts("load");
return self;
}
+ initialize
{
puts("initialise");
return self;
}
@end
int
main(int argc, char *argv[])
{
puts("creating object");
[TestObject new];
puts("object done");
return 0;
}
- strict aliasing in gcc33,
Pete French <=