GCC bug
Leo Cacciari
leo.cacciari at gmail.com
Wed Nov 21 15:53:14 UTC 2007
Il giorno mar, 20/11/2007 alle 12.31 +0000, Steve Flynn ha scritto:
> On Nov 19, 2007 6:06 PM, Unai Uribarri <unaiur at gmail.com> wrote:
> > I've filled a bug report in the lauchpad six weeks ago,
> > https://bugs.launchpad.net/ubuntu/+source/gcc-4.1/+bug/158799.
> >
> > GCC is generating bad code when compiled with -O2. I believe that it's an
> > important issue, but so far the bug report has attracted no attention.
>
> Actually, upon lookling at your code on launchpad, I suspect you are
> falling victim to improper aliasing. You should refer to the ISO
> standard for more information on the rules for aliasing and compiler
> optimization.
>
> If the code works as expected without Optimzation, I'd suspect your
> code before I'd suspect GCC...
>
Infact, if you run the code in the bug report with -O2 _and_ -Wall
--pedantic, you'll see a warning that
dereferencing type-punned pointer will break strict-aliasing
This is why, with --no-strict-aliasing you get "right" executable. As
Steve said, suspect your code before suspecting gcc ;)
--
Leo "TheHobbit" Cacciari
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa รจ una parte del messaggio firmata digitalmente
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20071121/c23eb712/attachment.sig>
More information about the ubuntu-users
mailing list