<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111294>111294</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Assertion `(LHSExpr->containsErrors() || RHSExpr->containsErrors()) && "Should only occur in error-recovery path."' failed.
</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/M6carxE9d](https://godbolt.org/z/M6carxE9d)
Attempting to compile the following program with Clang Assertion Trunk:
```c
enum {
SHORT_FIXED_FRACTIONAL_BITS= --11,
SHORT_FIXED_ONE= 1<<SHORT_FIXED_FRACTIONAL_BITS
};
```
Stack dump:
```
clang: /root/llvm-project/clang/lib/Sema/SemaExpr.cpp:15334: clang::ExprResult clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*): Assertion `(LHSExpr->containsErrors() || RHSExpr->containsErrors()) && "Should only occur in error-recovery path."' failed.
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-assertions-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 -O3 <source>
1. <source>:4:1: current parser token '}'
#0 0x0000000003b99d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b99d28)
#1 0x0000000003b979ec llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b979ec)
#2 0x0000000003ae61f8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000076d228442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000076d2284969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000076d228442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000076d2284287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000076d22842871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000076d228439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000006c2727c clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6c2727c)
#10 0x0000000006c27735 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6c27735)
#11 0x000000000669933d clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x669933d)
#12 0x00000000066a3b0a clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66a3b0a)
#13 0x000000000665f4ad clang::Parser::ParseEnumBody(clang::SourceLocation, clang::Decl*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x665f4ad)
#14 0x0000000006667328 clang::Parser::ParseEnumSpecifier(clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6667328)
#15 0x0000000006663656 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6663656)
#16 0x000000000661f964 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x661f964)
#17 0x00000000066203ce clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66203ce)
#18 0x0000000006627b63 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6627b63)
#19 0x0000000006628a4d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6628a4d)
#20 0x0000000006628ef0 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6628ef0)
#21 0x000000000661af32 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x661af32)
#22 0x00000000044f0998 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44f0998)
#23 0x00000000047aa2e9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47aa2e9)
#24 0x0000000004728c2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4728c2e)
#25 0x000000000488fb6e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x488fb6e)
#26 0x0000000000cd801f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd801f)
#27 0x0000000000ccfd2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000000004534669 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
#29 0x0000000003ae66a4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3ae66a4)
#30 0x0000000004534c5f 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
#31 0x00000000044fa59d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fa59d)
#32 0x00000000044fb68d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fb68d)
#33 0x0000000004502fb5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4502fb5)
#34 0x0000000000cd4eef clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd4eef)
#35 0x0000000000ba49a4 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xba49a4)
#36 0x000076d228429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#37 0x000076d228429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#38 0x0000000000ccf7de _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xccf7de)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWltz2ziy_jXwC4oqErw_-EHWZeI5nnHKcp06byoQBCWMSYAHAB15f_0WQMomaFmJZ5XZndpUEvHS6P7660ajSQIrxXac0msQ34B4eYU7vRfy-oX9gXmURfFVIcqX64VoWlZTCVeHthaSShDOIYhv9lq3CoRzgNYArXeiLEStZ0LuAFr_A6D1bwnB8rDKSxAvAcp-XBzlwF8Cf97_P9eaNq1mfAe1gKQHA_WewkrUtfhmbrRS7CRu4Dem93BRY76Dc6Wo1Exw-Cg7_mQM90oTv_9L-nPKuwaC9KY_gxDCzZf7h8ft-vb_Vsvt-mG-eLy9_31-t725fdyAcAk9LwgAWpyWv_99ZWQCEC5AuDijCQ5o0iUIbybIxt5vNCZPsOya9r0H_Skx7tqQoLUUQgO0ruvnxmul-IMSc9pLoHXNCoDWG9rg4Wd1aOWMtEZ1EIdhZLQc1YFwbm4_UNXVenzVjrdHNx2ryxvG71uAsrEEES0FaA7QwhkoOknonSDYhGVy84ZxLF_uWyqxFvJ_GC8nAgbMe52vV3OD_S3mhh2U3X3ZGAEPhCsiuMaMq5WUQiqAMoByCNIFSBfw4byYlUQJQAkECG32oqtLKHj9AgUhnYSMQ2rEPUmJeKbyBbZY72cAIYBSWGFW03LWx-rr3Wq-WUHVFQ3TEMOi20FJWyG1ye3JDGF63xUzIpohou8Dy5TqqAJoDTEvIeOk7sp-ahCJ1R4WmDxpiQk1rLWStlIQqhQtobKxMJfNSKyUIAxrWkLZcaiIZK2efZiA_gz4-ddhymG56xrKtRpSULQ25Yaa4dFjzRjS0MPHGClP24mJ1gXjx9vQ25XfsKy8CHo76AmjEbet0dvpttMzBb3GsAA975AlHlaNp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