[cfe-dev] Help with working around an ICE in Apple clang

Luc Bourhis luc_j_bourhis at mac.com
Sat Jul 28 08:37:51 PDT 2012


Hi,

some code of mine triggers an ICE with Apple clang version 3.1 (tags/Apple/clang-318.0.61) but not with the released clang 3.1. Unfortunately, I need to support the version coming with Xcode. I was hoping the experts on this mailing list could help me make sense of the problem and point me toward coming with a workaround better than the only solution I could find by myself (see below).

Here is how to reproduce the problem. With the file attached to this message,

~> /usr/bin/c++ -S -O3 -I$cctbxsrc -I$cctbx_build_default/include -I$cctbxroot/boost finalise_at_last.cpp

0  clang             0x00000001101dd422 _ZL15PrintStackTracePv + 34
1  clang             0x00000001101dd8a9 _ZL13SignalHandleri + 553
2  libsystem_c.dylib 0x00007fff8d311cfa _sigtramp + 26
3  libsystem_c.dylib 0x00000001109560a8 _sigtramp + 18446603342720549832
4  clang             0x000000010f55d7c4 llvm::SelectionDAGBuilder::visitRet(llvm::ReturnInst const&) + 1428
5  clang             0x000000010f55cd60 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) + 48
6  clang             0x000000010f55c592 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 66
7  clang             0x000000010f55c4c8 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 40
8  clang             0x000000010f489f91 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 2417
9  clang             0x000000010f4851d5 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 789
10 clang             0x000000010f484eae llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 110
11 clang             0x000000010f479fb2 llvm::FPPassManager::runOnFunction(llvm::Function&) + 322
12 clang             0x000000010f47f4bb llvm::FPPassManager::runOnModule(llvm::Module&) + 155
13 clang             0x000000010f47a8c1 llvm::MPPassManager::runOnModule(llvm::Module&) + 289
14 clang             0x000000010f47a2c5 llvm::PassManagerImpl::run(llvm::Module&) + 277
15 clang             0x000000010f47a1ad llvm::PassManager::run(llvm::Module&) + 13
16 clang             0x000000010f458e3c clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 4508
17 clang             0x000000010f456641 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 513
18 clang             0x000000010f3220f6 clang::ParseAST(clang::Sema&, bool) + 406
19 clang             0x000000010f320bd7 clang::CodeGenAction::ExecuteAction() + 855
20 clang             0x000000010f2f313f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 879
21 clang             0x000000010f2f1dcb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2683
22 clang             0x000000010f2e45ce cc1_main(char const**, char const**, char const*, void*) + 5086
23 clang             0x000000010f2bedd8 main + 648
24 clang             0x000000010f2beb44 start + 52
Stack dump:
0.	Program arguments: /usr/bin/clang -cc1 -triple x86_64-apple-macosx10.7.4 -S -disable-free -disable-llvm-verifier -main-file-name finalise_at_last.cpp -pic-level 2 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 128.2 -coverage-file finalise_at_last.s -resource-dir /usr/bin/../lib/clang/3.1 -I /Users/luc/Developer/cctbx/cctbx_project -I /Users/luc/Developer/cctbx/cctbx_build_default/include -I /Users/luc/Developer/cctbx/boost -fmodule-cache-path /var/folders/kx/qz2frq7d0p9fn8rg0w4gmmjm0000gn/T/clang-module-cache -O3 -fdeprecated-macro -fdebug-compilation-dir /Users/luc/Developer/Tests/clang-Xcode-4-4-symm-rank-1-crash -ferror-limit 19 -fmessage-length 104 -stack-protector 1 -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o finalise_at_last.s -x c++ finalise_at_last.cpp 
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'finalise_at_last.cpp'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z16finalise_at_lastmPdS_'

Thanks in advance for any help,

Luc Bourhis


 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: finalise_at_last.cpp
Type: application/octet-stream
Size: 1269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120728/8926a591/attachment.obj>


More information about the cfe-dev mailing list