------- Additional Comments From tjw at omnigroup dot com  2004-02-04 08:00 -------
Hrm.  I thought of that, but was misled by the fact that adding -Wstrict-aliasing 
didn't report any 
warnings.  I'm probably misunderstanding what this warning does (certainly looking at 
the only test 
case for it I could find (gcc/testsuite/gcc.dg/alias-1.c) yields warnings that don't 
make sense.

Anyway, I'll try your suggestion, but I'd also think that if the -W flag is going to 
have a name of 
'strict-aliasing' then it would be less confusing the more bad constructs it could 
detect.

As an example:

int x(float *f)
{
    return *(int *)f;
}

compiled with:

$PREFIX/bin/g++ -O2 -Wall -fstrict-aliasing -Wstrict-aliasing -c foo.cpp

yields no warnings.   Maybe I need to go read the language laws on aliasing more 
closely, but I 
thought this was a classic example.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13992

Reply via email to