Closed llvmbot closed 5 years ago
It does not make a sense to take an address of intrinsic function. There is an assertion in the code which checks that condition. Also LLVM does not allow to invoke an intrinsic other than donothing, patchpoint, statepoint, coro_resume or coro_destroy.
I just tested with clang 3.6.0 on OS X (10.10.2). The issue persists, so this isn't just a 3.5 bug.
I've tested on Ubuntu (14.10, x86_64) with clang 3.6.0 and did not face this issue. For some reason this bug manifests itself on OS X but not Ubuntu.
Extended Description
If I compile a very simple C++ program, clang crashes complaining that the address of an intrinsic cannot be taken. As far as I can tell, clang should be able to compile this, and the fact that it cannot is a bug. The invocation and output are:
$ clang++-3.5 -v -emit-llvm -target mipsel -o out.bc -c t.cc ⏎ ✱ ◼ clang version 3.5.1 (tags/RELEASE_351/final) Target: mipsel Thread model: posix "/usr/local/Cellar/llvm35/3.5.1/lib/llvm-3.5/bin/clang" -cc1 -triple mipsel -emit-llvm-bc -disable-free -main-file-name t.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -target-cpu mips32r2 -target-feature -n64 -target-feature +o32 -target-abi o32 -mfloat-abi hard -target-linker-version 241.9 -v -dwarf-column-info -coverage-file /Users/mjbshaw/School/cs6960/a2/pathtracer/out.bc -resource-dir /usr/local/Cellar/llvm35/3.5.1/lib/llvm-3.5/bin/../lib/clang/3.5.1 -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir /Users/mjbshaw/School/cs6960/a2/pathtracer -ferror-limit 19 -fmessage-length 112 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o out.bc -x c++ t.cc clang -cc1 version 3.5.1 based upon LLVM 3.5.1 default target x86_64-apple-darwin14.1.0
include "..." search starts here:
include <...> search starts here:
/usr/local/include /usr/local/Cellar/llvm35/3.5.1/lib/llvm-3.5/bin/../lib/clang/3.5.1/include /usr/include End of search list. Cannot take the address of an intrinsic! %call = invoke i32 @llvm.mips.loadi(i32 signext 0, i32 signext 0) to label %invoke.cont unwind label %lpad Cannot take the address of an intrinsic! %call = invoke i32 @llvm.mips.loadi(i32 signext 0, i32 signext 0) to label %invoke.cont unwind label %lpad fatal error: error in backend: Broken function found, compilation aborted! clang: error: clang frontend command failed with exit code 70 (use -v to see invocation) clang version 3.5.1 (tags/RELEASE_351/final) Target: mipsel Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /var/folders/vf/2d0_lsz10zz_31khhsxhsn5r0000gn/T/t-8d447b.cpp clang: note: diagnostic msg: /var/folders/vf/2d0_lsz10zz_31khhsxhsn5r0000gn/T/t-8d447b.sh clang: note: diagnostic msg:
If I compile with -fno-exceptions, then it compiles successfully (presumably because there are no unwind tables being created). Additionally, if I move the declaration/definition of the variable foo to after the loadi function call, then it compiles successfully (even without -fno-exceptions).