Bug 40051 - [4.3, 4.4, 4.5] regression member variable of a C++ class is read to a register for future use before it is written
Summary: [4.3, 4.4, 4.5] regression member variable of a C++ class is read to a regist...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-06 21:54 UTC by John Keeping
Modified: 2009-05-06 22:31 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
*.i file with which the bug is demonstrated (148.28 KB, application/octet-stream)
2009-05-06 21:56 UTC, John Keeping
Details
Patch against trunk 147188 to revert commit 138953 (498 bytes, patch)
2009-05-06 22:00 UTC, John Keeping
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Keeping 2009-05-06 21:54:43 UTC
SVN commit 138953 introduced a bug where code compiled at -O2 and above reads a value into a register before it is written in a function called by the optimized code.

This is demonstrated in the code for the Enigmail plugin to Mozilla Thunderbird as discussed at https://bugs.gentoo.org/show_bug.cgi?id=246421 I haven't been able to produce a more minimal test case - it seems to need a significant portion of the surrounding infrastructure to trigger this.

I've reversed commit 138953 on a recent trunk snapshot and it fixes this bug but I don't know if this introduces a regression on other bugs.
Comment 1 John Keeping 2009-05-06 21:56:45 UTC
Created attachment 17814 [details]
*.i file with which the bug is demonstrated
Comment 2 Andrew Pinski 2009-05-06 21:59:18 UTC
>SVN commit 138953 introduced a bug where code compiled at -O2 and above reads a
value into a register before it is written in a function called by the
optimized code.

No, from the sound of it there is an alias violation in the code.
Comment 3 John Keeping 2009-05-06 22:00:30 UTC
Created attachment 17815 [details]
Patch against trunk 147188 to revert commit 138953
Comment 5 John Keeping 2009-05-06 22:31:13 UTC
> No, from the sound of it there is an alias violation in the code.

You're right, I had thought of that but had read that Mozilla code was compiled with -fno-strict-aliasing because of this. Looking more closely the code in this extension isn't and so fails.

Now that I've added -fno-strict-aliasing it works.

Sorry for the noise.