public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55981] New: std::atomic store is split in two smaller stores
@ 2013-01-14 22:39 eugeni.stepanov at gmail dot com
  2013-01-14 22:46 ` [Bug other/55981] " eugeni.stepanov at gmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: eugeni.stepanov at gmail dot com @ 2013-01-14 22:39 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55981
           Summary: std::atomic store is split in two smaller stores
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: eugeni.stepanov@gmail.com


Created attachment 29166
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29166
miscompiled program

Hi,

in the attached program, std::atomic<unsigned long> store is compiled as two
4-byte stores, becoming not atomic at all. This happens at -O2 and higher.

To reproduce,
# g++ -std=c++11 -O3 1.cc  -lpthread -o 1
# ./1
100000004

^ this can also be 300000002, both outcomes are invalid.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-02-16 13:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 22:39 [Bug other/55981] New: std::atomic store is split in two smaller stores eugeni.stepanov at gmail dot com
2013-01-14 22:46 ` [Bug other/55981] " eugeni.stepanov at gmail dot com
2013-01-14 22:48 ` eugeni.stepanov at gmail dot com
2013-01-14 23:08 ` pinskia at gcc dot gnu.org
2013-01-15 12:30 ` [Bug target/55981] " paulmck at linux dot vnet.ibm.com
2013-01-15 14:22 ` ubizjak at gmail dot com
2013-01-15 14:26 ` ubizjak at gmail dot com
2013-01-15 14:30 ` ubizjak at gmail dot com
2013-01-15 19:38 ` ubizjak at gmail dot com
2013-01-15 19:39 ` ubizjak at gmail dot com
2013-01-15 20:02 ` ubizjak at gmail dot com
2013-01-17 16:25 ` uros at gcc dot gnu.org
2013-01-17 22:51 ` uros at gcc dot gnu.org
2013-01-17 22:54 ` ubizjak at gmail dot com
2014-02-16 13:14 ` jackie.rosen at hushmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).