[LLVMbugs] [Bug 11164] New: __sync_sub_and_fetch completely broken on ARM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 18 05:52:29 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11164

           Summary: __sync_sub_and_fetch completely broken on ARM
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: csdavec at swan.ac.uk
                CC: llvmbugs at cs.uiuc.edu


This trivial program fails to compile with clang for ARMv7:

void die(int *obj) { __sync_sub_and_fetch(obj, 1); }

When using gas, we get this error:


$ echo 'void die(int *obj) { __sync_sub_and_fetch(obj, 1); }'|
~/WebOS/llvm/Debug+Asserts/bin/clang -B /opt/PalmPDK/arm-gcc/bin/
-ccc-host-triple arm-none-linux-gnueabi -march=armv7-a -x c -c -
/var/folders/cw/8wjq1rsd4tbb9cwd3wt6b3_m0000gn/T/--wz8N7B.s: Assembler
messages:
/var/folders/cw/8wjq1rsd4tbb9cwd3wt6b3_m0000gn/T/--wz8N7B.s:26: Error: garbage
following instruction -- `dmb ish'
/var/folders/cw/8wjq1rsd4tbb9cwd3wt6b3_m0000gn/T/--wz8N7B.s:37: Error: garbage
following instruction -- `dmb ish'
clang: error: assembler command failed with exit code 1 (use -v to see
invocation)

With the integrated assembler, it's a little more spectacular:


$ echo 'void die(int *obj) { __sync_sub_and_fetch(obj, 1); }' | clang
-ccc-host-triple arm-none-linux-gnueabi -march=armv7-a -x c -c - -integrated-as
Not implemented yet
0  clang             0x00000001057fa965 _ZL15PrintStackTracePv + 53
1  clang             0x00000001057fafcc _ZL13SignalHandleri + 364
2  libsystem_c.dylib 0x00007fff96c41cfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff6337a518 _sigtramp + 18446744072844707896
4  clang             0x00000001057facab raise + 27
5  clang             0x00000001057fad6a abort + 26
6  clang             0x0000000105784681 llvm::MCStreamer::EmitFnStart() + 49
7  clang             0x0000000105009f29
llvm::ARMException::BeginFunction(llvm::MachineFunction const*) + 41
8  clang             0x000000010500caa1 llvm::AsmPrinter::EmitFunctionHeader()
+ 1345
9  clang             0x000000010489c96b
llvm::AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) + 43
10 clang             0x0000000104a7cd2c
llvm::ARMAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) + 76
11 clang             0x000000010516725e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
12 clang             0x00000001056f1ade
llvm::FPPassManager::runOnFunction(llvm::Function&) + 478
13 clang             0x00000001056f1eaf
llvm::FPPassManager::runOnModule(llvm::Module&) + 127
14 clang             0x00000001056f2144
llvm::MPPassManager::runOnModule(llvm::Module&) + 516
15 clang             0x00000001056f28ec
llvm::PassManagerImpl::run(llvm::Module&) + 172
16 clang             0x00000001056f2dcd llvm::PassManager::run(llvm::Module&) +
29
17 clang             0x0000000103990e2b (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_ostream*) + 1035
18 clang             0x00000001039909b8
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 104
19 clang             0x0000000103ae6920
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 656
20 clang             0x0000000103b278a9 clang::ParseAST(clang::Sema&, bool) +
889
21 clang             0x00000001037f5232
clang::ASTFrontendAction::ExecuteAction() + 258
22 clang             0x0000000103ae44ee clang::CodeGenAction::ExecuteAction() +
1182
23 clang             0x00000001037f4e35 clang::FrontendAction::Execute() + 357
24 clang             0x00000001037c1fce
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 974
25 clang             0x00000001037936f2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1170
26 clang             0x000000010377f204 cc1_main(char const**, char const**,
char const*, void*) + 1220
27 clang             0x000000010378cbaa main + 666
28 clang             0x000000010377ed34 start + 52
Stack dump:
0.    Program arguments: /Users/theraven/WebOS/llvm/Debug+Asserts/bin/clang
-cc1 -triple armv7-none-linux-gnueabi -emit-obj -mrelax-all -disable-free
-main-file-name - -mrelocation-model static -mdisable-fp-elim
-mconstructor-aliases -target-abi aapcs-linux -target-cpu cortex-a8 -mfloat-abi
soft -target-feature +soft-float-abi -target-linker-version 123.2.1
-momit-leaf-frame-pointer -coverage-file -.o -resource-dir
/Users/theraven/WebOS/llvm/Debug+Asserts/bin/../lib/clang/3.1
-fmodule-cache-path
/var/folders/cw/8wjq1rsd4tbb9cwd3wt6b3_m0000gn/T/clang-module-cache
-ferror-limit 19 -fmessage-length 200 -fno-signed-char -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fdiagnostics-show-option -fcolor-diagnostics -o -.o -x c - 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module '-'.
4.    Running pass 'ARM Assembly Printer' on function '@die'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Error generating preprocessed source(s) - ignoring
input from stdin.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list