Bug 40825 - mis-optimization of libstdc++'s atomic.cc:__atomic_flag_wait_explicit() at -O2
Summary: mis-optimization of libstdc++'s atomic.cc:__atomic_flag_wait_explicit() at -O2
Status: VERIFIED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-22 14:05 UTC by jbeulich
Modified: 2011-10-13 07:58 UTC (History)
1 user (show)

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


Attachments
example source (257 bytes, text/plain)
2009-07-22 14:06 UTC, jbeulich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jbeulich 2009-07-22 14:05:30 UTC
Compiling this file for NetWare, or, after pre-processing it and stripping down to a reasonably small one, natively for Linux produces "'d' is used uninitialized in this function".

While the original code in libstdc++ looks broken (which will be reported as a separate bug), the warning and the generated code are incorrect, since 'd' definitely gets constructed at source level.

Neither the waring nor the incorrect code generation can be observed at -O1.

I will attach the stripped-down, usable on plain Linux, example in a second.
Comment 1 jbeulich 2009-07-22 14:06:15 UTC
Created attachment 18238 [details]
example source
Comment 2 Richard Biener 2009-07-22 14:08:13 UTC
Can you give a hint on what exactly is miscompiled?  (the testcase isn't an
executable one that fails if miscompiled...)
Comment 3 Paolo Carlini 2009-07-22 14:09:27 UTC
The library issue is PR40654.
Comment 4 jbeulich 2009-07-22 14:17:29 UTC
Just as the warning says - construction of 'd' is missing. The warning lead me to look at the generated code, just to see that they are in sync (and hence perhaps have the same root cause).
Comment 5 Paolo Carlini 2011-10-12 17:02:52 UTC
Seems fixed in 4.5.x, at least, no warning. Otherwise, re-open.
Comment 6 jbeulich 2011-10-13 07:58:09 UTC
In 4.5.3, the warning is gone but the code is still broken.

In 4.6.1 the code is correct.