Project

General

Profile

Bug #1263

Updated by Dmitry M. over 8 years ago

~~~ cpp <pre><code class="cpp"> 
 #include <atomic> 
 #include <stdint.h> 

 int main() 
 { 
     std::atomic<uint64_t> a(0); 
     return ++a == 1 ? 0 : 1; 
 } 
 ~~~ </code></pre> 

 This code compiles by gcc without any problems. However, clang fails to compile it for targets `armeabi`, `x86` @armeabi@, @x86@ and `mips` @mips@ (but compiles for `armeabi-v7a` @armeabi-v7a@ and `armeabi-v7a-hard`, @armeabi-v7a-hard@, which are 32-bit too!): 

 ~~~ 
 <pre> 
 $NDK/toolchains/llvm-3.7/prebuilt/linux-x86_64/bin/clang++ -MMD -MP -MF ./obj/local/x86/objs/test/test.o.d \ 
     -gcc-toolchain $NDK/toolchains/x86-5/prebuilt/linux-x86_64 -target i686-none-linux-android \ 
     -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC \ 
     -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-exceptions -fno-rtti \ 
     -O2 -g -DNDEBUG -fomit-frame-pointer -fstrict-aliasing \ 
     -I$NDK/sources/cxx-stl/gnu-libstdc++/5/include \ 
     -I$NDK/sources/cxx-stl/gnu-libstdc++/5/libs/x86/include \ 
     -I$NDK/sources/cxx-stl/gnu-libstdc++/5/include/backward \ 
     -Ijni \ 
     -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security \ 
     -fPIE -fexceptions -frtti -Wall -Wextra -Werror -std=gnu++11 \ 
     -c -I$NDK/sources/crystax/include -I$NDK/platforms/android-9/arch-x86/usr/include \ 
     jni/test.cpp -o ./obj/local/x86/objs/test/test.o 
 In file included from jni/test.cpp:1: 
 In file included from $NDK/sources/cxx-stl/gnu-libstdc++/5/include/atomic:41: 
 $NDK/sources/cxx-stl/gnu-libstdc++/5/include/bits/atomic_base.h:296:16: error: cannot compile this atomic library call yet 
       { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } 
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 1 error generated. 
 ~~~ </pre>

Back