<font size=2 face="sans-serif">One other thing .. the 'store' method gives
the same failure, but the 'exchange' method seems to work.</font>
<br>
<br><font size=2 face="sans-serif">std::atomic<uint_fast16_t> b;</font>
<br><font size=2 face="sans-serif">b = 0;
// fail</font>
<br><font size=2 face="sans-serif">b.store(0); //
fail</font>
<br><font size=2 face="sans-serif">b.exchange(0);
// success</font>
<br><font size=2 face="sans-serif"><br>
Michael Blocksome<br>
Blue Gene Messaging<br>
blocksom@us.ibm.com<br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Michael Blocksome/Rochester/IBM@IBMUS</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">llvm-bgq-discuss@lists.alcf.anl.gov,
</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">02/05/2013 04:21 PM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">[Llvm-bgq-discuss]
clang ICE: std::atomic<uint_fast16_t></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by:
</font><font size=1 face="sans-serif">llvm-bgq-discuss-bounces@lists.alcf.anl.gov</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=2 face="sans-serif">I recently learned that I should not
be using types such as 'uint32_t' for atomics, but instead should use the
"fast" versions of these types, such as 'uint_fast32_t'. However,
when I use these "fast" types with clang and the std::atomic::operator=
overload I get a nasty ICE.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I get the same ICE with 'uint64_t', so I'm guessing that 'uint_fast*_t'
is a typedef to 'uint64_t'...</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
----</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
$> cat atomic_store.cc</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
#include <atomic></font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
int main ()</font><font size=3> </font><font size=2 face="sans-serif"><br>
{</font><font size=3> </font><font size=2 face="sans-serif"><br>
// this works fine ...</font><font size=3> </font><font size=2 face="sans-serif"><br>
std::atomic<uint_fast16_t> a(0);</font><font size=3> </font><font size=2 face="sans-serif"><br>
a++;</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
std::atomic<uint_fast16_t> b;</font><font size=3> </font><font size=2 face="sans-serif"><br>
b = 0; // fail</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
std::atomic<uint16_t> c;</font><font size=3> </font><font size=2 face="sans-serif"><br>
c = 0; // success</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
std::atomic<uint32_t> d;</font><font size=3> </font><font size=2 face="sans-serif"><br>
d = 0; // success</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
std::atomic<uint64_t> e;</font><font size=3> </font><font size=2 face="sans-serif"><br>
e = 0; // fail</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
std::atomic<uint_fast32_t> f;</font><font size=3> </font><font size=2 face="sans-serif"><br>
f = 0; // fail</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
return 0;</font><font size=3> </font><font size=2 face="sans-serif"><br>
};</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
$> /bghome/blocksom/development/c++11/bgclang++ -ferror-limit=10 -I
/bghome/blocksom/development/c++11/install/libc++/include -std=c++11 -stdlib=libc++
-g -c atomic_store.cc -o atomic_store.o</font><font size=3> </font><font size=2 face="sans-serif"><br>
fatal error: error in backend: Cannot select: 0x10005b64a80: ch = AtomicStore
0x10005b67ac0, 0x10005b66ca0, 0x10005b679c0<Volatile ST8[%__a_.i.i62]>
[ID=10]</font><font size=3> </font><font size=2 face="sans-serif"><br>
dbg:/bghome/blocksom/development/c++11/install/libc++/include/atomic:571</font><font size=3>
</font><font size=2 face="sans-serif"><br>
0x10005b66ca0: i64,ch = CopyFromReg 0x10005ac0660, 0x10005b60c30
[ID=8] dbg:/bghome/blocksom/development/c++11/install/libc++/include/atomic:571</font><font size=3>
</font><font size=2 face="sans-serif"><br>
0x10005b60c30: i64 = Register %vreg1 [ID=5]</font><font size=3>
</font><font size=2 face="sans-serif"><br>
0x10005b679c0: i64,ch = load 0x10005ac0660, 0x10005b65390, 0x10005b61230<LD8[%.atomictmp.i.i57]>
[ORD=98] [ID=7] dbg:/bghome/blocksom/development/c++11/install/libc++/include/atomic:571</font><font size=3>
</font><font size=2 face="sans-serif"><br>
0x10005b65390: i64 = FrameIndex<14> [ORD=98] [ID=1]</font><font size=3>
</font><font size=2 face="sans-serif"><br>
0x10005b61230: i64 = undef [ORD=98] [ID=2]</font><font size=3>
</font><font size=2 face="sans-serif"><br>
In function: main</font><font size=3> </font><font size=2 face="sans-serif"><br>
clang: error: clang frontend command failed with exit code 70 (use -v to
see invocation)</font><font size=3> </font><font size=2 face="sans-serif"><br>
clang version 3.3 (trunk 170456)</font><font size=3> </font><font size=2 face="sans-serif"><br>
Target: powerpc64-bgq-linux</font><font size=3> </font><font size=2 face="sans-serif"><br>
Thread model: posix</font><font size=3> </font><font size=2 face="sans-serif"><br>
clang: note: diagnostic msg: PLEASE submit a bug report to </font><a href=http://llvm.org/bugs/><font size=2 color=blue face="sans-serif"><u>http://llvm.org/bugs/</u></font></a><font size=2 face="sans-serif">
and include the crash backtrace, preprocessed source, and associated run
script.</font><font size=3> </font><font size=2 face="sans-serif"><br>
clang: note: diagnostic msg: <br>
********************</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:</font><font size=3>
</font><font size=2 face="sans-serif"><br>
Preprocessed source(s) and associated run script(s) are located at:</font><font size=3>
</font><font size=2 face="sans-serif"><br>
clang: note: diagnostic msg: /tmp/atomic_store-j00aLw.cpp</font><font size=3>
</font><font size=2 face="sans-serif"><br>
clang: note: diagnostic msg: /tmp/atomic_store-j00aLw.sh</font><font size=3>
</font><font size=2 face="sans-serif"><br>
clang: note: diagnostic msg: </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
********************</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Any ideas?</font><font size=3> <br>
<br>
</font><font size=2 face="sans-serif"><br>
--> </font><a href=http://en.cppreference.com/w/c/types/integer><font size=2 color=blue face="sans-serif"><u>http://en.cppreference.com/w/c/types/integer</u></font></a><font size=3>
</font><font size=2 face="sans-serif"><br>
--> </font><a href=http://en.cppreference.com/w/cpp/atomic/atomic/operator%3D><font size=2 color=blue face="sans-serif"><u>http://en.cppreference.com/w/cpp/atomic/atomic/operator%3D</u></font></a><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Thanks,</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
Michael Blocksome<br>
Blue Gene Messaging<br>
blocksom@us.ibm.com</font><tt><font size=2>_______________________________________________<br>
llvm-bgq-discuss mailing list<br>
llvm-bgq-discuss@lists.alcf.anl.gov<br>
</font></tt><a href="https://lists.alcf.anl.gov/mailman/listinfo/llvm-bgq-discuss"><tt><font size=2>https://lists.alcf.anl.gov/mailman/listinfo/llvm-bgq-discuss</font></tt></a><tt><font size=2><br>
</font></tt>
<br>