[clang] [analyzer] Fix crash in PaddingChecker on dependent field types (PR #232986)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 17 14:22:43 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 62086 tests passed
* 2146 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.Analysis/padding_cpp.cpp</summary>

```
Exit Code: -6

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -std=c++20 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/padding_cpp.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -std=c++20 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/padding_cpp.cpp
# .---command stderr------------
# | clang: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/ASTContext.cpp:2595: TypeInfo clang::ASTContext::getTypeInfoImpl(const Type *) const: Assertion `!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"' failed.
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
# | Stack dump:
# | 0.	Program arguments: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/include -nostdsysteminc -analyze -setup-static-analyzer -std=c++20 -analyzer-checker=optin.performance -analyzer-config optin.performance.Padding:AllowedPad=2 -verify /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/Analysis/padding_cpp.cpp
# | 1.	<eof> parser at end of file
# |  #0 0x000000000990f6db llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:931:13
# |  #1 0x000000000990c571 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
# |  #2 0x000000000991011b SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:474:38
# |  #3 0x000000000990ff88 SignalHandlerTerminate(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
# |  #4 0x00007a983b71ecb0 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x45cb0)
# |  #5 0x00007a983b77f1ac pthread_kill (/usr/lib/x86_64-linux-gnu/libc.so.6+0xa61ac)
# |  #6 0x00007a983b71eb7e raise (/usr/lib/x86_64-linux-gnu/libc.so.6+0x45b7e)
# |  #7 0x00007a983b7018ec abort (/usr/lib/x86_64-linux-gnu/libc.so.6+0x288ec)
# |  #8 0x00007a983b702979 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29979)
# |  #9 0x00007a983b714f75 __assert_fail (/usr/lib/x86_64-linux-gnu/libc.so.6+0x3bf75)
# | #10 0x000000000ca3c9e4 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/ASTContext.cpp:0:5
# | #11 0x000000000ca3e2ef clang::ASTContext::getTypeInfo(clang::Type const*) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/ASTContext.cpp:2113:17
# | #12 0x000000000ca3df3e getTypeInfoInChars /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/ASTContext.cpp:2022:19
# | #13 0x000000000ca3df3e clang::ASTContext::getTypeInfoInChars(clang::QualType) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/ASTContext.cpp:2028:10
# | #14 0x000000000d1d81fa operator() /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:0:23
# | #15 0x000000000d1d81fa (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:1911:5
# | #16 0x000000000d1d58a1 operator++ /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:0:5
# | #17 0x000000000d1d58a1 (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:1444:67
# | #18 0x000000000d1cda5d Layout /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:1384:20
# | #19 0x000000000d1cda5d clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:3503:15
# | #20 0x000000000ba4c1d5 getAlignment /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecordLayout.h:196:43
# | #21 0x000000000ba4c1d5 (anonymous namespace)::PaddingChecker::visitRecord(clang::RecordDecl const*, unsigned long) const /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:93:35
# | #22 0x000000000ba4be0f (anonymous namespace)::PaddingChecker::checkASTDecl(clang::TranslationUnitDecl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) const::LocalVisitor::VisitRecordDecl(clang::RecordDecl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp:53:9
# | #23 0x000000000ccd9199 WalkUpFromCXXRecordDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/DeclNodes.inc:438:1
# | #24 0x000000000ccd9199 TraverseCXXRecordDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2206:1
# | #25 0x000000000ccd9199 clang::DynamicRecursiveASTVisitorBase<false>::TraverseCXXRecordDecl(clang::CXXRecordDecl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/DeclNodes.inc:438:1
# | #26 0x000000000cccff6e TraverseDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/DeclNodes.inc:438:1
# | #27 0x000000000cccff6e clang::DynamicRecursiveASTVisitorBase<false>::TraverseDecl(clang::Decl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:310:17
# | #28 0x000000000cce18bd TraverseDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:0:47
# | #29 0x000000000cce18bd TraverseLambdaExpr /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2899:12
# | #30 0x000000000cce18bd clang::DynamicRecursiveASTVisitorBase<false>::TraverseLambdaExpr(clang::LambdaExpr*) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/StmtNodes.inc:360:1
# | #31 0x000000000ccd0738 clang::RecursiveASTVisitor<(anonymous namespace)::Impl<false>>::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:706:7
# | #32 0x000000000cce6451 TraverseStmt /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:0:47
# | #33 0x000000000cce6451 TraverseCXXNoexceptExpr /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:3116:1
# | #34 0x000000000cce6451 clang::DynamicRecursiveASTVisitorBase<false>::TraverseCXXNoexceptExpr(clang::CXXNoexceptExpr*) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/StmtNodes.inc:738:1
# | #35 0x000000000ccd0738 clang::RecursiveASTVisitor<(anonymous namespace)::Impl<false>>::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:706:7
# | #36 0x000000000cce26a8 TraverseStmt /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:0:47
# | #37 0x000000000cce26a8 TraverseConstantExpr /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2629:1
# | #38 0x000000000cce26a8 clang::DynamicRecursiveASTVisitorBase<false>::TraverseConstantExpr(clang::ConstantExpr*) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/StmtNodes.inc:424:1
# | #39 0x000000000ccd0738 clang::RecursiveASTVisitor<(anonymous namespace)::Impl<false>>::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*>>>>*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:706:7
# | #40 0x000000000ccffdbf TraverseFunctionProtoTypeLoc /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:1440:5
# | #41 0x000000000ccffdbf clang::DynamicRecursiveASTVisitorBase<false>::TraverseFunctionProtoTypeLoc(clang::FunctionProtoTypeLoc, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/TypeNodes.inc:50:1
# | #42 0x000000000ccd11b2 clang::RecursiveASTVisitor<(anonymous namespace)::Impl<false>>::TraverseTypeLoc(clang::TypeLoc, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:752:1
# | #43 0x000000000ccd0d8d clang::DynamicRecursiveASTVisitorBase<false>::TraverseTypeLoc(clang::TypeLoc, bool) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:349:3
# | #44 0x000000000cd3c4ab clang::RecursiveASTVisitor<(anonymous namespace)::Impl<false>>::TraverseFunctionHelper(clang::FunctionDecl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2370:5
# | #45 0x000000000ccd5c6a TraverseFunctionDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2423:1
# | #46 0x000000000ccd5c6a clang::DynamicRecursiveASTVisitorBase<false>::TraverseFunctionDecl(clang::FunctionDecl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/DeclNodes.inc:262:1
# | #47 0x000000000cccfe72 TraverseDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/include/clang/AST/DeclNodes.inc:262:1
# | #48 0x000000000cccfe72 clang::DynamicRecursiveASTVisitorBase<false>::TraverseDecl(clang::Decl*) /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/lib/AST/DynamicRecursiveASTVisitor.cpp:310:17
# | #49 0x000000000ccdafbe TraverseFunctionTemplateDecl /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/include/clang/AST/RecursiveASTVisitor.h:2095:1
# | #50 0x000000000ccdafbe clang::DynamicRecursiveASTVisitorBase<false>::TraverseFunctionTemplateDecl(clan
# | ...
# `---data was truncated (10240/15462) (change limit with -D output_limit=N)
# error: command failed with exit status: -6

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/232986


More information about the cfe-commits mailing list