public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58542] New: std::atomic<__int128_t>::store broken with -march=corei7
@ 2013-09-26 14:03 2013.bugzilla.gcc.gnu.org at ingomueller dot net
  2013-09-26 14:04 ` [Bug c++/58542] " 2013.bugzilla.gcc.gnu.org at ingomueller dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: 2013.bugzilla.gcc.gnu.org at ingomueller dot net @ 2013-09-26 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58542
           Summary: std::atomic<__int128_t>::store broken with
                    -march=corei7
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 2013.bugzilla.gcc.gnu.org at ingomueller dot net

The attached file shows how std::atomic<__int128_t>::store is broken when
compiled with --march=corei7. Then relevant code looks like this:

    std::atomic<__int128_t> i;
    i = -1;
    std::cout << std::hex << uint64_t(i>>64) << uint64_t(i) << std::endl;

Depending on the compile flags, the program outputs the correct or an incorrect
result:

    $ g++-4.8 -std=c++11 test.cpp -O1 -latomic -o test_right && ./test_right 
    ffffffffffffffffffffffffffffffff
    $ g++-4.8 -std=c++11 test.cpp -O1 -march=corei7 -latomic -o test_wrong &&
./test_wrong 
    0ffffffffffffffff

It looks like the upper 64bit are not stored.

I tested GCC 4.7.3 and 4.8.1, but I don't have a snapshot at hand -- sorry.


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

end of thread, other threads:[~2013-10-25 20:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-26 14:03 [Bug c++/58542] New: std::atomic<__int128_t>::store broken with -march=corei7 2013.bugzilla.gcc.gnu.org at ingomueller dot net
2013-09-26 14:04 ` [Bug c++/58542] " 2013.bugzilla.gcc.gnu.org at ingomueller dot net
2013-09-26 17:20 ` [Bug rtl-optimization/58542] " ubizjak at gmail dot com
2013-09-26 21:20 ` [Bug rtl-optimization/58542] [4.7/4.8/4.9 Regression] subreg splitting pass mishandles TImode immediates ubizjak at gmail dot com
2013-10-08 16:10 ` ubizjak at gmail dot com
2013-10-08 18:23 ` ubizjak at gmail dot com
2013-10-23 12:13 ` [Bug rtl-optimization/58542] [4.7/4.8/4.9 Regression] Arguments of __atomic_* functions are converted in unsigned mode ubizjak at gmail dot com
2013-10-23 17:47 ` rth at gcc dot gnu.org
2013-10-24 22:28 ` rth at gcc dot gnu.org
2013-10-25 20:06 ` rth at gcc dot gnu.org
2013-10-25 20:09 ` rth at gcc dot gnu.org
2013-10-25 20:11 ` rth at gcc dot gnu.org

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).