<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107052>107052</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang][Trunk] Crash at clang::Sema::BuiltinFPClassification(clang::CallExpr*, unsigned int, unsigned int)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
Compiler Explorer: [https://godbolt.org/z/f3e3G3167](https://godbolt.org/z/f3e3G3167)
Clang trunk crashes when compiling the following program:
```c
int main () {
__builtin_fpclassify (0, 1, 4, 3, 2, (inf)) ;
}
```
Clang stack dump:
```
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: /opt/compiler-explorer/clang-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:2:47: current parser token ')'
2. <source>:1:13: parsing function body 'main'
3. <source>:1:13: in compound statement ('{}')
#0 0x00000000038a5198 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38a5198)
#1 0x00000000038a3304 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38a3304)
#2 0x00000000037edbb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000765f2c642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00000000063cb195 clang::Sema::BuiltinFPClassification(clang::CallExpr*, unsigned int, unsigned int) (.part.0) SemaChecking.cpp:0:0
#5 0x00000000063e98d0 clang::Sema::CheckBuiltinFunctionCall(clang::FunctionDecl*, unsigned int, clang::CallExpr*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x63e98d0)
#6 0x0000000006782dce clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, clang::CallExpr::ADLCallKind) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6782dce)
#7 0x000000000677e335 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x677e335)
#8 0x00000000067851ec clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x67851ec)
#9 0x00000000062061eb clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x62061eb)
#10 0x00000000061fdf21 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x61fdf21)
#11 0x000000000620015a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x620015a)
#12 0x00000000062002f9 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+0x62002f9)
#13 0x00000000062052b9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+0x62052b9)
#14 0x0000000006292c77 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6292c77)
#15 0x0000000006286b27 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6286b27)
#16 0x000000000628759d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x628759d)
#17 0x0000000006288821 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6288821)
#18 0x000000000628ab6a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x628ab6a)
#19 0x0000000006184d50 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6184d50)
#20 0x00000000061cd752 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x61cd752)
#21 0x000000000617ee67 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+0x617ee67)
#22 0x000000000617fd53 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+0x617fd53)
#23 0x0000000006188282 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6188282)
#24 0x000000000618a078 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x618a078)
#25 0x000000000618a690 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x618a690)
#26 0x0000000006178d12 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6178d12)
#27 0x00000000041b5655 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x41b5655)
#28 0x000000000445cf41 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x445cf41)
#29 0x00000000043df8cb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x43df8cb)
#30 0x0000000004544873 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4544873)
#31 0x0000000000cb865c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb865c)
#32 0x0000000000cb259d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#33 0x00000000041fee39 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#34 0x00000000037edfe3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x37edfe3)
#35 0x00000000041ff059 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#36 0x00000000041c4d07 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x41c4d07)
#37 0x00000000041c56bd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x41c56bd)
#38 0x00000000041cf0ec clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x41cf0ec)
#39 0x0000000000cb5941 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb5941)
#40 0x0000000000b8b234 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xb8b234)
#41 0x0000765f2c629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#42 0x0000765f2c629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#43 0x0000000000cb203e _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xcb203e)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1z4yjW_jXKDWWXBPq8yIVjx_P2vJntVDu1ty6EkMO0DFpAaWd__RYgJ0L-6EzbPbNTOzXt2BKc8zwPBzh8YKXYhlN6GyR3QbK4wZ1-FvL2lf2OeZzHyU0pqtfbudi2rKES3O_aRkgqAzQDQXL3rHWrAjQL4DKAy42oStHoqZCbAC7_HcBljSj6BUVpFiSLAOYfLw6LIFwE4cx9zhvMN0DLjn8FRGL1TBX49kw5IBYXMy-fKahF04hv5lcrxUbirXHlzKSh-5-434xrsMWMgwDmASxAkN0FYe8SAADW67JjjWZ8XbekMRrVr6ZsGMA5iMxHbD6Q-YDmI4A547WBb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