<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58551>58551</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Compiler crash when using -ftime-trace after 27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dyung
</td>
</tr>
</table>
<pre>
Internally we have tests that attempt to collect information about the compilation by using -ftime-trace and suddenly several of them started to fail with crashes. I bisected the failure back to commit 27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf, and reduced the failure to the following:
```c
struct {
short quantval[4]
};
```
Here is the crash backtrace when compiling the above code with `-c -ftime-trace`:
```
$ ~/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang -c -ftime-trace repro.c
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang -c -ftime-trace repro.c
1. repro.c:3:1: current parser token '}'
2. repro.c:1:1: parsing struct/union body 'struct (unnamed at repro.c:1:1)'
#0 0x0000555a4e525df4 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x0000555a4e523b8c llvm::sys::CleanupOnSignal(unsigned long) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x3f19b8c)
#2 0x0000555a4e45a938 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007f316ad91420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x0000555a4e88ec24 clang::SourceLocation::print(llvm::raw_ostream&, clang::SourceManager const&) const (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x4284c24)
#5 0x0000555a4e88f09f clang::SourceLocation::printToString[abi:cxx11](clang::SourceManager const&) const (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x428509f)
#6 0x0000555a517461d3 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> llvm::function_ref<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> ()>::callback_fn<clang::Expr::isIntegerConst
antExpr(clang::ASTContext const&, clang::SourceLocation*) const::'lambda'()>(long) ExprConstant.cpp:0:0
#7 0x0000555a4e4a8570 llvm::timeTraceProfilerBegin(llvm::StringRef, llvm::function_ref<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> ()>) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux
/bin/clang+0x3e9e570)
#8 0x0000555a5177d4ed clang::Expr::isIntegerConstantExpr(clang::ASTContext const&, clang::SourceLocation*) const (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x71734ed)
#9 0x0000555a50c63aaf clang::Sema::VerifyIntegerConstantExpression(clang::Expr*, llvm::APSInt*, clang::Sema::VerifyICEDiagnoser&, clang::Sema::AllowFoldKind) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x
6659aaf)
#10 0x0000555a51290ebb clang::Sema::BuildArrayType(clang::QualType, clang::ArrayType::ArraySizeModifier, clang::Expr*, unsigned int, clang::SourceRange, clang::DeclarationName) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-
linux/bin/clang+0x6c86ebb)
#11 0x0000555a512add03 GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
#12 0x0000555a512b251e clang::Sema::GetTypeForDeclarator(clang::Declarator&, clang::Scope*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6ca851e)
#13 0x0000555a50a62500 clang::Sema::HandleField(clang::Scope*, clang::RecordDecl*, clang::SourceLocation, clang::Declarator&, clang::Expr*, clang::InClassInitStyle, clang::AccessSpecifier) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225f
fa1ff04cccf-linux/bin/clang+0x6458500)
#14 0x0000555a50a62cf5 clang::Sema::ActOnField(clang::Scope*, clang::Decl*, clang::SourceLocation, clang::Declarator&, clang::Expr*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6458cf5)
#15 0x0000555a50759695 void llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::callback_fn<clang::Parser::ParseStructUnionBody(clang::SourceLocation, clang::TypeSpecifierType, clang::RecordDecl*)::'lambda'(clang::ParsingFieldDeclarator&
)>(long, clang::ParsingFieldDeclarator&) ParseDecl.cpp:0:0
#16 0x0000555a50771223 clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6167223)
#17 0x0000555a50771b23 clang::Parser::ParseStructUnionBody(clang::SourceLocation, clang::TypeSpecifierType, clang::RecordDecl*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6167b23)
#18 0x0000555a50798bf6 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttri
butes&) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x618ebf6)
#19 0x0000555a5076d636 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameCont
ext) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6163636)
#20 0x0000555a5073ffc2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x6135fc2)
#21 0x0000555a50740890 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#22 0x0000555a5074604b clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x613c04b)
#23 0x0000555a50746eda clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x613ceda)
#24 0x0000555a50747314 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x613d314)
#25 0x0000555a5073b27a clang::ParseAST(clang::Sema&, bool, bool) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x613127a)
#26 0x0000555a4f84c3f8 clang::CodeGenAction::ExecuteAction() (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x52423f8)
#27 0x0000555a4f0e0719 clang::FrontendAction::Execute() (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x4ad6719)
#28 0x0000555a4f0678be clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x4a5d8be)
#29 0x0000555a4f1c5bd3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x4bbbbd3)
#30 0x0000555a4b9c8844 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x13be844)
#31 0x0000555a4b9c1958 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x0000555a4eed4869 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) con
st::'lambda'()>(long) Job.cpp:0:0
#33 0x0000555a4e45b0da llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x3e510da)
#34 0x0000555a4eed50bf clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#35 0x0000555a4ee9e589 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x4894589)
#36 0x0000555a4ee9f00d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-
linux/bin/clang+0x489500d)
#37 0x0000555a4eea862c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/cl
ang+0x489e62c)
#38 0x0000555a4b9c6c83 clang_main(int, char**) (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x13bcc83)
#39 0x00007f316a83f083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#40 0x0000555a4b9c155e _start (/home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin/clang+0x13b755e)
clang-16: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 16.0.0 (https://github.com/llvm/llvm-project.git 27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dyung/src/upstream/27d8eedd5a3cd7fd644be4f06225ffa1ff04cccf-linux/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlW1t327gR_jXyC451eL88-EG-Zd1mGzdy91UHBECZDUVqQdK28us7A1ASQVGqnBOzOVsltkkCAub7ZjAzuDAp-ebqoaiFLGieb8irIM_0RZBaVHVF6mdaE1rXYrWuSV0SVua5YDXJirSUK1pnZUFoUjZQ-CygdLXOcv002ZCmyooluUzrbCUua0mZILTgpGo4FwV0VYkXIWlOyhS_vSJVTWUtOPaT0iwnr1n9TJik1bOopuSBJFkFfWMF6AtrNFKQhLJvWrLVKquJE_JICM596jIepjzwvER4qRU4jp-m1E5Ty2OMpRPnRgkjBW9Yr0loTd0C1vIVIEzc2cS6nVizSWDp_0zfV7VsgIxJeK3vCameS1mTPxta1C80n_jX3sS_bb8c3k7c615D-vY3Ab1mleYQ8SpUmrHXZ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