[webkit-dev] -fstrict-aliasing error
Maciej Stachowiak
mjs at apple.com
Sun May 14 20:25:24 PDT 2006
Hi Andrea,
On May 14, 2006, at 7:56 AM, Andrea Mannori wrote:
> hi all,
> trying to compile webcore and webkit framework with -fstrict-
> aliasing i get a lot of warning (considered error by default)
> ignoring them produce an unusefull code, as well as "correct" them
> (bus error and segmentation fault on start)
> is just me?
> ther a way to have a solution? i' d like to use this flag to use -
> ftree-vectorize also (on my g4)
-fstrict-aliasing makes stronger requirements on code correctness
than many other optimizations. Specifically, it assumes that
locations with different types never reside in the same memory
location. That breaks code that does things like this:
void printFloatBits(float f)
{
float* floatAddr = &f;
int* intAddr = (int*)floatAddr; // bad! violates strict aliasing rules
printf("%x", *intAddr);
}
Strict aliasing requires working around this using union types. It
would be a good idea to make WebCore safe to use with -fstrict-
aliasing and then turn it on in the default build, but it would take
significant work.
More generally, it would be cool to try different optimizations that
aren't on by defaut and see what effect they have on speed and code
size.
Cheers,
Maciej
More information about the webkit-dev
mailing list