[llvm-bugs] [Bug 26211] New: clang-3.9: Assert when re-defining sqrt() function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 19 13:34:25 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26211

            Bug ID: 26211
           Summary: clang-3.9: Assert when re-defining sqrt() function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brzycki at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

There is a compiler assert when overwriting sqrt(). The output from clang is
the following:

$
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/aarch64-sarc-linux-gnu-clang
-O0  main-7c7b0f.c
main-7c7b0f.c:1:5: warning: incompatible redeclaration of library function
'sqrt' [-Wincompatible-library-redeclaration]
int sqrt(int n) {
    ^
main-7c7b0f.c:1:5: note: 'sqrt' is a builtin with type 'double (double)'
1 warning generated.
brzycki at spa103 ~/x $
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/aarch64-sarc-linux-gnu-clang
-Wno-incompatible-library-redeclaration -O0  main-7c7b0f.c
brzycki at spa103 ~/x $
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/aarch64-sarc-linux-gnu-clang
-Wno-incompatible-library-redeclaration -O1  main-7c7b0f.c
clang-3.9: /tmp/tmp.pwSURnmdYf.spa189/llvm/lib/IR/Instruction.cpp:152: bool
llvm::Instruction::hasUnsafeAlgebra() const: Assertion
`isa<FPMathOperator>(this) && "getting fast-math flag on invalid op"' failed.
0  clang-3.9       0x0000000002ec6ccb
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 44
1  clang-3.9       0x0000000002ec7048
2  clang-3.9       0x0000000002ec56d9 llvm::sys::RunSignalHandlers() + 138
3  clang-3.9       0x0000000002ec6718
4  libpthread.so.0 0x0000003bd240f710
5  libc.so.6       0x0000003bd1c32925 gsignal + 53
6  libc.so.6       0x0000003bd1c34105 abort + 373
7  libc.so.6       0x0000003bd1c2ba4e
8  libc.so.6       0x0000003bd1c2bb10 __assert_perror_fail + 0
9  clang-3.9       0x00000000029e2068 llvm::Instruction::hasUnsafeAlgebra()
const + 76
10 clang-3.9       0x0000000002f6a1c9
llvm::LibCallSimplifier::optimizeSqrt(llvm::CallInst*, llvm::IRBuilder<true,
llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >&) + 405
11 clang-3.9       0x0000000002f6e6e0
llvm::LibCallSimplifier::optimizeCall(llvm::CallInst*) + 1434
12 clang-3.9       0x0000000002b593a2
13 clang-3.9       0x0000000002b59f70
14 clang-3.9       0x0000000002b53bf0
15 clang-3.9       0x0000000002b2a1c6
16 clang-3.9       0x0000000002b2923f
17 clang-3.9       0x0000000002b27741
18 clang-3.9       0x0000000002b23b30
19 clang-3.9       0x0000000002b24b7d
20 clang-3.9       0x0000000002b24e74
21 clang-3.9       0x0000000002a1a24b
llvm::FPPassManager::runOnFunction(llvm::Function&) + 315
22 clang-3.9       0x0000000002a1a3c2
llvm::FPPassManager::runOnModule(llvm::Module&) + 118
23 clang-3.9       0x0000000002a1a70f
24 clang-3.9       0x0000000002a1addd
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 271
25 clang-3.9       0x0000000002a1afe9
llvm::legacy::PassManager::run(llvm::Module&) + 39
26 clang-3.9       0x00000000030af67a
27 clang-3.9       0x00000000030af7ab
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 127
28 clang-3.9       0x0000000003994c3c
29 clang-3.9       0x00000000041e8d51 clang::ParseAST(clang::Sema&, bool, bool)
+ 827
30 clang-3.9       0x000000000354380f clang::ASTFrontendAction::ExecuteAction()
+ 323
31 clang-3.9       0x0000000003997832 clang::CodeGenAction::ExecuteAction() +
1722
32 clang-3.9       0x00000000035432a5 clang::FrontendAction::Execute() + 135
33 clang-3.9       0x00000000034fc58f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1109
34 clang-3.9       0x000000000363af4e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1160
35 clang-3.9       0x00000000016b88d6 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 1019
36 clang-3.9       0x00000000016af6c5
37 clang-3.9       0x00000000016b014d main + 1965
38 libc.so.6       0x0000003bd1c1ed1d __libc_start_main + 253
39 clang-3.9       0x00000000016ab9c9
Stack dump:
0.      Program arguments:
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/clang-3.9
-cc1 -triple aarch64-sarc-linux-gnu -emit-obj -disable-free -main-file-name
main-7c7b0f.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu
generic -target-feature +neon -target-abi aapcs -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/../lib/clang/3.9.0
-isysroot
/sarc-c/compiler_tmp/tools/cross/aarch64/sysroot-llvm/aarch64-sarc-linux-gnu/sysroot
-internal-isystem
/sarc-c/compiler_tmp/tools/cross/aarch64/sysroot-llvm/aarch64-sarc-linux-gnu/sysroot/usr/local/include
-internal-isystem
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin/../lib/clang/3.9.0/include
-internal-externc-isystem
/sarc-c/compiler_tmp/tools/cross/aarch64/sysroot-llvm/aarch64-sarc-linux-gnu/sysroot/include
-internal-externc-isystem
/sarc-c/compiler_tmp/tools/cross/aarch64/sysroot-llvm/aarch64-sarc-linux-gnu/sysroot/usr/include
-O1 -Wno-incompatible-library-redeclaration -fdebug-compilation-dir
/sarc/spa/users/brzycki/x -ferror-limit 19 -fmessage-length 170
-fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/main-7c7b0f-7231ad.o -x c
main-7c7b0f.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'main-7c7b0f.c'.
4.      Running pass 'Combine redundant instructions' on function '@main'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0
Target: aarch64-sarc-linux-gnu
Thread model: posix
InstalledDir:
/sarc-c/compiler_tmp/tools/cross/llvm-3.9/2016-01-19-18-47-02-3a5bf2b-master/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/main-7c7b0f-3c43d5.c
clang-3.9: note: diagnostic msg: /tmp/main-7c7b0f-3c43d5.sh
clang-3.9: note: diagnostic msg:

********************


We are compiling from the merged repo
https://github.com/llvm-project/llvm-project/ and the failing sha in that repo
is 3a5bf2b on the master branch.

This bug does not recreate if I use a sha in llvm-project that is near to the
3.7 release, sha 9e59f25 on branch master.

In the failing case it does not occur with -O0, only at -O1 and above.

I will attach the outputted .sh and .c files to the ticket.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160119/e369ae7c/attachment-0001.html>


More information about the llvm-bugs mailing list