bug with -O2 in g++ Debian 4.0.2-9 ?

Andrew Haley aph@redhat.com
Thu Feb 23 10:11:00 GMT 2006


Jerome Robert writes:
 >  Is this program wrong

Yes.

See ISO C9899:199 Section 6.3.2.3.  

These lines are particularly bogus:

    void ** aa=(void **)(void *)&a;
    void ** ab=(void **)(void *)&b;

All the cast to (void *) does is suppress a useful warning.

-fno-strict-aliasing may help.

Andrew.



More information about the Gcc-help mailing list