[Bug c++/58542] New: std::atomic<__int128_t>::store broken with -march=corei7
2013.bugzilla.gcc.gnu.org at ingomueller dot net
gcc-bugzilla@gcc.gnu.org
Thu Sep 26 14:03:00 GMT 2013
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.
More information about the Gcc-bugs
mailing list