<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - clang-3.9: Assert when re-defining sqrt() function"
href="https://llvm.org/bugs/show_bug.cgi?id=26211">26211</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-3.9: Assert when re-defining sqrt() function
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>brzycki@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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@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@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
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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
<a href="https://github.com/llvm-project/llvm-project/">https://github.com/llvm-project/llvm-project/</a> 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>