[llvm-bugs] [Bug 42632] New: Crash with parallel for loop

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 16 04:16:43 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42632

            Bug ID: 42632
           Summary: Crash with parallel for loop
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: compile-fail, regression
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: v.reichelt at netcologne.de
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

The following valid code snippet triggers an assertion in the static analyzer
when compiled with "clang++ --analyze -fopenmp":

==============================================
void foo()
{
#pragma omp parallel for
  for (int i = 0; i < 8; ++i)
    for (int j = 0, k = 0; j < 8; ++j)
      ;
}
==============================================

This is a recent regression, introduced between r365294 and r366050.

Here's the relevant part of the stack trace:

clang-9: /tmp/LLVM/llvm/tools/clang/lib/AST/ParentMap.cpp:117: void
clang::ParentMap::setParent(const clang::Stmt*, const clang::Stmt*): Assertion
`Parent' failed.

 #5 0x00007fa049b96ce8 abort (/lib64/libc.so.6+0x36ce8)
 #6 0x00007fa049b8e566 __assert_fail_base (/lib64/libc.so.6+0x2e566)
 #7 0x00007fa049b8e612 (/lib64/libc.so.6+0x2e612)
 #8 0x00000000047b4d8f clang::ParentMap::setParent(clang::Stmt const*,
clang::Stmt const*) (/LLVM/bin/clang-9+0x47b4d8f)
 #9 0x000000000444e6bb addParentsForSyntheticStmts(clang::CFG const*,
clang::ParentMap&) (.part.187) (/LLVM/bin/clang-9+0x444e6bb)
#10 0x0000000004450288 clang::AnalysisDeclContext::getParentMap()
(/LLVM/bin/clang-9+0x4450288)
#11 0x00000000038e297b (anonymous
namespace)::DeadStoresChecker::checkASTCodeBody(clang::Decl const*,
clang::ento::AnalysisManager&, clang::ento::BugReporter&) const
(/LLVM/bin/clang-9+0x38e297b)
#12 0x0000000003ba4f7f
clang::ento::CheckerManager::runCheckersOnASTBody(clang::Decl const*,
clang::ento::AnalysisManager&, clang::ento::BugReporter&)
(/LLVM/bin/clang-9+0x3ba4f7f)
#13 0x0000000003847f0e (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*) (/LLVM/bin/clang-9+0x3847f0e)
#14 0x000000000385ec1f clang::RecursiveASTVisitor<(anonymous
namespace)::AnalysisConsumer>::TraverseFunctionDecl(clang::FunctionDecl*)
(/LLVM/bin/clang-9+0x385ec1f)
#15 0x0000000003848961 clang::RecursiveASTVisitor<(anonymous
namespace)::AnalysisConsumer>::TraverseDecl(clang::Decl*)
(.part.5440.constprop.5518) (/LLVM/bin/clang-9+0x3848961)
#16 0x0000000003860200 (anonymous
namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&)
(/LLVM/bin/clang-9+0x3860200)
#17 0x0000000003861dcb (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&)
(/LLVM/bin/clang-9+0x3861dcb)
#18 0x0000000003ce80b9 clang::ParseAST(clang::Sema&, bool, bool)
(/LLVM/bin/clang-9+0x3ce80b9)
#19 0x0000000002cf7089 clang::FrontendAction::Execute()
(/LLVM/bin/clang-9+0x2cf7089)

clang version 9.0.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190716/fd4292de/attachment.html>


More information about the llvm-bugs mailing list