Project

General

Profile

Actions

Bug #1263

closed

[clang][atomics] Clang can't compile call of __atomic_add_fetch with 64-bit argument for 32-bit targets

Added by Dmitry M. about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
toolchain
Target version:
Start date:
02/11/2016
Due date:
% Done:

100%

Estimated time:
CPU Architecture:
arm, mips, x86
Host OS:
Toolchain:
clang-3.6, clang-3.7
Android version:
CrystaX NDK Version:

Description

#include <atomic>
#include <stdint.h>

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

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

$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.
Actions #1

Updated by Dmitry M. about 8 years ago

  • CPU Architecture arm added
Actions #2

Updated by Dmitry M. almost 8 years ago

  • Description updated (diff)
Actions #3

Updated by Dmitry M. almost 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This is fixed in clang-3.8, so closing this ticket as not actual anymore.

Actions

Also available in: Atom PDF