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