<font><font face="tahoma,sans-serif">Hi;<br></font></font><br><div class="gmail_quote">On Wed, Jun 6, 2012 at 9:45 AM, Csaba Raduly <span dir="ltr"><<a href="mailto:rcsaba@gmail.com" target="_blank">rcsaba@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Jun 5, 2012 at 5:51 PM, Richtarsky, Martin wrote:<br>
> Hi,<br>
><br>
> has anyone seen breakage with recent trunk revisions for a clang Release+Assert build?<br>
><br>
> Platform: x86_64 SLES 11 SP1<br>
> Thread model: posix<br>
> gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux)<br>
><br>
> 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.<br>
> 0 clang 0x0000000001ef0bef<br>
> 1 clang 0x0000000001ef2b76<br>
> 2 libpthread.so.0 0x00007f37ae0616a0<br>
> 3 libc.so.6 0x00007f37ad3aa945 gsignal + 53<br>
> 4 libc.so.6 0x00007f37ad3abf21 abort + 385<br>
> 5 libc.so.6 0x00007f37ad3a3810 __assert_fail + 240<br>
> 6 clang 0x0000000001abaa6d<br>
> 7 clang 0x0000000001e8f8ef llvm::FPPassManager::runOnFunction(llvm::Function&) + 623<br>
> 8 clang 0x0000000001e8f993 llvm::FPPassManager::runOnModule(llvm::Module&) + 51<br>
> 9 clang 0x0000000001e8f434 llvm::MPPassManager::runOnModule(llvm::Module&) + 564<br>
> 10 clang 0x0000000001e8f590 llvm::PassManagerImpl::run(llvm::Module&) + 160<br>
> 11 clang 0x00000000008179a1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 1905<br>
> 12 clang 0x0000000000814be7<br>
> 13 clang 0x000000000097823c clang::ParseAST(clang::Sema&, bool, bool) + 460<br>
> 14 clang 0x0000000000813284 clang::CodeGenAction::ExecuteAction() + 68<br>
> 15 clang 0x00000000006b0be2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 338<br>
> 16 clang 0x0000000000695646 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1366<br>
> 17 clang 0x000000000068a338 cc1_main(char const**, char const**, char const*, void*) + 1448<br>
> 18 clang 0x0000000000694a40 main + 6880<br>
> 19 libc.so.6 0x00007f37ad396bc6 __libc_start_main + 230<br>
> 20 clang 0x0000000000687cb9<br>
> Stack dump:<br>
> 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<br>
> 1. <eof> parser at end of file<br>
> 2. Code generation<br>
> 3. Running pass 'Function Pass Manager' on module 'absvdi2-SueaiA.i'.<br>
> 4. Running pass 'Branch Probability Basic Block Placement' on function '@__absvdi2'<br>
> absvdi2-SueaiA.sh: line 1: 37973 Aborted<br>
<br>
</div></div>Yes, I've seen this a lot; mostly on SuSE. I suspect GCC is<br>
miscompiling something.<br>
The solution (workaround) is to reduce the optimization level to -O2.<br>
<br>
$ svn diff ../llvm/configure<br>
Index: ../llvm/configure<br>
===================================================================<br>
--- ../llvm/configure (revision 157922)<br>
+++ ../llvm/configure (working copy)<br>
@@ -5466,7 +5466,7 @@<br>
case "$llvm_cv_os_type" in<br>
FreeBSD) optimize_option=-O2 ;;<br>
MingW) optimize_option=-O2 ;;<br>
- *) optimize_option=-O3 ;;<br>
+ *) optimize_option=-O2 ;;<br>
esac ;;<br>
*) optimize_option="$withval" ;;<br>
esac<br></blockquote><div><br></div><div>For official SUSE packages we first build with -O0 then build with 1st stage clang as usual.</div><div><br></div><div>Regards,</div><div>ismail</div><div> </div></div>