llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.37k stars 12.14k forks source link

Assertion failure in in PaddingChecker::visitRecord #39318

Open hokein opened 5 years ago

hokein commented 5 years ago
Bugzilla Link 39971
Version trunk
OS Linux
CC @devincoughlin,@haoNoQ

Extended Description

$ cat test-PaddingChecker__visitRecord.cc namespace a { template struct atomic { b c; }; } typedef long d; struct e { alignas(64) a::atomic f; d g; alignas(64) a::atomic h; char i[64 - sizeof(d)]; };

$ ./clang-tidy -checks="clang-analyzer" test-PaddingChecker__visitRecord.cc -- -std=c++11 F1212 11:16:58.700911 40300 logging.cc:82] assert.h assertion failed at third_party/llvm/llvm/tools/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:108 in void (anonymous namespace)::PaddingChecker::visitRecord(const clang::RecordDecl , uint64_t) const: !DiffPad.isNegative() && "DiffPad should not be negative" Check failure stack trace: @ 0x5630d023a4f9 (anonymous namespace)::PaddingChecker::visitRecord() @ 0x5630d022a00d clang::RecursiveASTVisitor<>::TraverseCXXRecordDecl() @ 0x5630d0225c8b clang::RecursiveASTVisitor<>::TraverseDecl() @ 0x5630d022c1d9 clang::RecursiveASTVisitor<>::TraverseTranslationUnitDecl() @ 0x5630d0225f4c clang::RecursiveASTVisitor<>::TraverseDecl() @ 0x5630d02243f7 clang::ento::check::ASTDecl<>::_checkDecl<>() @ 0x5630d04812bf clang::ento::CheckerManager::runCheckersOnASTDecl() @ 0x5630d019f6d9 (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit() @ 0x5630d071320c clang::MultiplexConsumer::HandleTranslationUnit() @ 0x5630d08ce414 clang::ParseAST() @ 0x5630d070cd63 clang::FrontendAction::Execute() @ 0x5630d05c17e1 clang::CompilerInstance::ExecuteAction() @ 0x5630d051a7d1 clang::tooling::FrontendActionFactory::runInvocation() @ 0x5630cfe1cc27 clang::tidy::runClangTidy()::ActionFactory::runInvocation() @ 0x5630d051a53a clang::tooling::ToolInvocation::runInvocation() @ 0x5630d0519f26 clang::tooling::ToolInvocation::run() @ 0x5630d051c625 clang::tooling::ClangTool::run() @ 0x5630cfe1896f clang::tidy::runClangTidy()

llvmbot commented 5 years ago

This is still reproducible.

hokein commented 5 years ago

assigned to @haoNoQ