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]

strict aliasing issue


Here's my reduced testcase:

typedef long GLint;
extern void aglChoosePixelFormat(const GLint *);
void find(const int *alistp) {
const int *blist;
int list[32];
if (alistp)
blist = alistp;
else {
list[3] = 42; /* this store disappears with -O1 -fstrict- aliasing */
blist = list;
}
aglChoosePixelFormat((GLint*)blist);
}


(The original testcase is C++, from the FLTK project.)

If I compile this with -O1 -fstrict-aliasing, the "= 42" store disappears. I've confirmed this on mainline PPC and x86.

I'm not a language lawyer; is this a legal program? (If the program is legal, should I file a PR?)

stuart hastings
Apple Computer


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