The static checker stackdumps on OpenMP pragma
| Bugzilla Link | 31835 |
| Resolution | DUPLICATE |
| Resolved on | Nov 13, 2018 05:11 |
| Version | 3.9 |
| OS | Linux |
| Attachments | stack trace |
| Reporter | LLVM Bugzilla Contributor |
| CC | @devincoughlin,@haoNoQ |
Extended Description
When I run the static checker on a really simple program, it dumps a stack trace. (attached)
The program is:
I moved on to version 5.0 and there are no problems with this code anymore.
*** This bug has been marked as a duplicate of bug llvm/llvm-project#27325 ***
Should be fixed with https://reviews.llvm.org/D30565. Could you check with the current master?
Reproduced on ToT.
It looks like we are not failing gracefully when run into OMP AST nodes in the CFG:
- thread #1: tid = 0x5752d0, 0x00007fffbb0e2dd6 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
- frame #0: 0x00007fffbb0e2dd6 libsystem_kernel.dylib
__pthread_kill + 10 frame #​1: 0x00007fffbb1ce787 libsystem_pthread.dylibpthread_kill + 90 frame #2: 0x00007fffbb048420 libsystem_c.dylibabort + 129 frame #​3: 0x0000000100f56137 clangllvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471 frame #4: 0x000000010439c757 clangclang::ento::ExprEngine::Visit(this=0x00007fff5fbf9db0, S=0x000000010c047400, Pred=0x000000010c06e700, DstTop=0x00007fff5fbf94b8) + 631 at ExprEngine.cpp:877 frame #​5: 0x000000010439a5a4 clangclang::ento::ExprEngine::ProcessStmt(this=0x00007fff5fbf9db0, S=const clang::CFGStmt @ 0x00007fff5fbf9650, Pred=0x000000010c06e670) + 532 at ExprEngine.cpp:464 frame #6: 0x000000010439a25a clangclang::ento::ExprEngine::processCFGElement(this=0x00007fff5fbf9db0, E=const clang::CFGElement @ 0x00007fff5fbf9730, Pred=0x000000010c06e670, StmtIdx=0, Ctx=0x00007fff5fbf9780) + 218 at ExprEngine.cpp:313 frame #​7: 0x00000001043814b4 clangclang::ento::CoreEngine::HandleBlockEntrance(this=0x00007fff5fbf9dc8, L=0x00007fff5fbf98f0, Pred=0x000000010c06e670) + 452 at CoreEngine.cpp:359 frame #8: 0x0000000104380a41 clangclang::ento::CoreEngine::dispatchWorkItem(this=0x00007fff5fbf9dc8, Pred=0x000000010c06e670, Loc=ProgramPoint @ 0x00007fff5fbf9a00, WU=0x00007fff5fbf9b08) + 225 at CoreEngine.cpp:250 frame #​9: 0x0000000104380418 clangclang::ento::CoreEngine::ExecuteWorkList(this=0x00007fff5fbf9dc8, L=0x000000010b2109c0, Steps=149998, InitState=clang::ento::ProgramStateRef @ 0x00007fff5fbf9d10) + 1736 at CoreEngine.cpp:235 frame #10: 0x0000000102c50365 clangclang::ento::ExprEngine::ExecuteWorkList(this=0x00007fff5fbf9db0, L=0x000000010b2109c0, Steps=150000) + 85 at ExprEngine.h:109 frame #​11: 0x0000000102c4fab9 clang(anonymous namespace)::AnalysisConsumer::ActionExprEngine(this=0x000000010b109ac0, D=0x000000010c0470a8, ObjCGCEnabled=false, IMode=Inline_Regular, VisitedCallees=0x00007fff5fbfa750) + 1481 at AnalysisConsumer.cpp:719 frame #12: 0x0000000102c4f379 clang(anonymous namespace)::AnalysisConsumer::RunPathSensitiveChecks(this=0x000000010b109ac0, D=0x000000010c0470a8, IMode=Inline_Regular, Visited=0x00007fff5fbfa750) + 153 at AnalysisConsumer.cpp:740 frame #​13: 0x0000000102c4ef2e clang(anonymous namespace)::AnalysisConsumer::HandleCode(this=0x000000010b109ac0, D=0x000000010c0470a8, Mode=2, IMode=Inline_Regular, VisitedCallees=0x00007fff5fbfa750) + 782 at AnalysisConsumer.cpp:687 frame #14: 0x0000000102c40fe8 clang(anonymous namespace)::AnalysisConsumer::HandleDeclsCallGraph(this=0x000000010b109ac0, LocalTUDeclsSize=1) + 904 at AnalysisConsumer.cpp:498 frame #​15: 0x0000000102c3c0f4 clang(anonymous namespace)::AnalysisConsumer::HandleTranslationUnit(this=0x000000010b109ac0, C=0x000000010b814800) + 820 at AnalysisConsumer.cpp:550 frame #16: 0x0000000102ced019 clangclang::ParseAST(S=0x000000010c040600, PrintStats=false, SkipFunctionBodies=false) + 1209 at ParseAST.cpp:159 frame #​17: 0x0000000101cdf545 clangclang::ASTFrontendAction::ExecuteAction(this=0x000000010b102120) + 485 at FrontendAction.cpp:558 frame #18: 0x0000000101cde560 clangclang::FrontendAction::Execute(this=0x000000010b102120) + 112 at FrontendAction.cpp:459 frame #​19: 0x0000000101c034d6 clangclang::CompilerInstance::ExecuteAction(this=0x000000010b20a010, Act=0x000000010b102120) + 2278 at CompilerInstance.cpp:953 frame #20: 0x0000000101d7c8da clangclang::ExecuteCompilerInvocation(Clang=0x000000010b20a010) + 5834 at ExecuteCompilerInvocation.cpp:249 frame #​21: 0x0000000100015c1a clangcc1_main(Argv=ArrayRef<const char *> @ 0x00007fff5fbfc300, Argv0="../build/clang-ninja/bin/clang", MainAddr=0x0000000100001aa0) + 4906 at cc1_main.cpp:221 frame #22: 0x0000000100005a2e clangExecuteCC1Tool(argv=ArrayRef<const char *> @ 0x00007fff5fbfd1a8, Tool=(Data = "", Length = 0)) + 622 at driver.cpp:299 frame #​23: 0x0000000100002c93 clangmain(argc_=6, argv_=0x00007fff5fbff980) + 4371 at driver.cpp:380 frame #24: 0x00007fffbafb4255 libdyld.dylib`start + 1
- frame #0: 0x00007fffbb0e2dd6 libsystem_kernel.dylib
There is a comment in ExprEngine::Visit() that says OMP statements are not even supposed to make it into the CFG -- we may not be handling CFG construction for them properly.
It seems impossible to add more then one attachment. The failing program is this:
#include
int main(){
#pragma omp critical { cerr << "OK!" << endl; } }