[cfe-dev] clang does not build in Release+Assert mode

Csaba Raduly rcsaba at gmail.com
Wed Jun 6 00:45:53 PDT 2012


On Tue, Jun 5, 2012 at 5:51 PM, Richtarsky, Martin  wrote:
> Hi,
>
> has anyone seen breakage with recent trunk revisions for a clang Release+Assert build?
>
> Platform: x86_64 SLES 11 SP1
> Thread model: posix
> gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux)
>
> clang: /local/mar_/llvm/include/llvm/ADT/DenseMap.h:123: void llvm::DenseMap<KeyT, ValueT, KeyInfoT>::clear() [with KeyT = llvm::MachineBasicBlock*, ValueT = <unnamed>::BlockChain*, KeyInfoT = llvm::DenseMapInfo<llvm::MachineBasicBlock*>]: Assertion `NumEntries == 0 && "Node count imbalance!"' failed.
> 0  clang           0x0000000001ef0bef
> 1  clang           0x0000000001ef2b76
> 2  libpthread.so.0 0x00007f37ae0616a0
> 3  libc.so.6       0x00007f37ad3aa945 gsignal + 53
> 4  libc.so.6       0x00007f37ad3abf21 abort + 385
> 5  libc.so.6       0x00007f37ad3a3810 __assert_fail + 240
> 6  clang           0x0000000001abaa6d
> 7  clang           0x0000000001e8f8ef llvm::FPPassManager::runOnFunction(llvm::Function&) + 623
> 8  clang           0x0000000001e8f993 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
> 9  clang           0x0000000001e8f434 llvm::MPPassManager::runOnModule(llvm::Module&) + 564
> 10 clang           0x0000000001e8f590 llvm::PassManagerImpl::run(llvm::Module&) + 160
> 11 clang           0x00000000008179a1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 1905
> 12 clang           0x0000000000814be7
> 13 clang           0x000000000097823c clang::ParseAST(clang::Sema&, bool, bool) + 460
> 14 clang           0x0000000000813284 clang::CodeGenAction::ExecuteAction() + 68
> 15 clang           0x00000000006b0be2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 338
> 16 clang           0x0000000000695646 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1366
> 17 clang           0x000000000068a338 cc1_main(char const**, char const**, char const*, void*) + 1448
> 18 clang           0x0000000000694a40 main + 6880
> 19 libc.so.6       0x00007f37ad396bc6 __libc_start_main + 230
> 20 clang           0x0000000000687cb9
> Stack dump:
> 0.      Program arguments: /local/mar_/buildtrunk_op2/Release+Asserts/bin/clang -cc1 -triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name absvdi2.c -pic-level 2 -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 11 -momit-leaf-frame-pointer -internal-isystem /local/mar_/llvm/projects/compiler-rt/SDKs/linux/usr/local/include -internal-isystem /local/mar_/buildtrunk_op2/Release+Asserts/bin/../lib/clang/3.2/include -internal-externc-isystem /local/mar_/llvm/projects/compiler-rt/SDKs/linux/include -internal-externc-isystem /local/mar_/llvm/projects/compiler-rt/SDKs/linux/usr/include -O3 -Wall -Werror -ferror-limit 19 -fmessage-length 102 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -x c absvdi2-SueaiA.i
> 1.      <eof> parser at end of file
> 2.      Code generation
> 3.      Running pass 'Function Pass Manager' on module 'absvdi2-SueaiA.i'.
> 4.      Running pass 'Branch Probability Basic Block Placement' on function '@__absvdi2'
> absvdi2-SueaiA.sh: line 1: 37973 Aborted

Yes, I've seen this a lot; mostly on SuSE. I suspect GCC is
miscompiling something.
The solution (workaround) is to reduce the optimization level to -O2.

$ svn diff ../llvm/configure
Index: ../llvm/configure
===================================================================
--- ../llvm/configure   (revision 157922)
+++ ../llvm/configure   (working copy)
@@ -5466,7 +5466,7 @@
     case "$llvm_cv_os_type" in
     FreeBSD) optimize_option=-O2 ;;
     MingW) optimize_option=-O2 ;;
-    *)     optimize_option=-O3 ;;
+    *)     optimize_option=-O2 ;;
     esac ;;
   *) optimize_option="$withval" ;;
 esac



Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds




More information about the cfe-dev mailing list