Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: {anonymous}::CastOperation::CheckCStyleCast(): Assertion `(DestType->containsErrors() || SrcExpr.get()->containsErrors() || SrcExpr.get()->containsErrors()) && "should only occur in error-recovery path."' failed. #50236

Closed
chengniansun opened this issue Jun 26, 2021 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid

Comments

@chengniansun
Copy link

chengniansun commented Jun 26, 2021

Bugzilla Link 50892
Version trunk
OS Linux
CC @zygoloid

Extended Description

$ clang-trunk -v

clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ cat mutant.c

p() {
  unsigned x[] = {p->a};
  (unsigned)x;
}

$ clang-trunk mutant.c

mutant.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
p() {
^
mutant.c:2:20: error: member reference base type 'int ()' is not a structure or union
  unsigned x[] = {p->a};
                  ~^ ~
clang-13: /tmp/tmp.xjN6dMkdrg-clang-builder/llvm-project/clang/lib/Sema/SemaCast.cpp:2833: void {anonymous}::CastOperation::CheckCStyleCast(): Assertion `(DestType->containsErrors() || SrcExpr.get()->containsErrors() || SrcExpr.get()->containsErrors()) && "should only occur in error-recovery path."' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /scratch/software/clang-trunk/bin/clang-13 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name mutant.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/default_c_finding_folder/crash_20210625_215453_00dc/delta/perses_result -resource-dir /scratch/software/clang-trunk/lib/clang/13.0.0 -c-isystem . -c-isystem /usr/local/include/cmsith -internal-isystem /scratch/software/clang-trunk/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/scratch/cnsun/workspace/perses-fuzzer/default_c_finding_folder/crash_20210625_215453_00dc/delta/perses_result -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-19ef58.o -x c mutant.c
1.	mutant.c:3:14: current parser token ';'
2.	mutant.c:1:5: parsing function body 'p'
3.	mutant.c:1:5: in compound statement ('{}')
 #0 0x00005645d9229184 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00005645d922693e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fa90c4193c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007fa90beb818b raise /build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007fa90be97859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007fa90be97729 get_sysdep_segment_value /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007fa90be97729 _nl_load_domain /build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007fa90bea8f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x00005645db5b41e1 (anonymous namespace)::CastOperation::CheckCStyleCast() SemaCast.cpp:0:0
 #9 0x00005645db5b5b5d clang::Sema::BuildCStyleCastExpr(clang::SourceLocation, clang::TypeSourceInfo*, clang::SourceLocation, clang::Expr*) (/scratch/software/clang-trunk/bin/clang-13+0x5ce7b5d)
#10 0x00005645db8e5211 clang::Sema::ActOnCastExpr(clang::Scope*, clang::SourceLocation, clang::Declarator&, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation, clang::Expr*) (/scratch/software/clang-trunk/bin/clang-13+0x6017211)
#11 0x00005645db4a450f clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/scratch/software/clang-trunk/bin/clang-13+0x5bd650f)
#12 0x00005645db49a610 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/scratch/software/clang-trunk/bin/clang-13+0x5bcc610)
#13 0x00005645db49c50b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/scratch/software/clang-trunk/bin/clang-13+0x5bce50b)
#14 0x00005645db49c5ad clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/scratch/software/clang-trunk/bin/clang-13+0x5bce5ad)
#15 0x00005645db49fb0d clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/scratch/software/clang-trunk/bin/clang-13+0x5bd1b0d)
#16 0x00005645db50774e clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/scratch/software/clang-trunk/bin/clang-13+0x5c3974e)
#17 0x00005645db4fece2 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributesWithRange&) (/scratch/software/clang-trunk/bin/clang-13+0x5c30ce2)
#18 0x00005645db4ff6ca clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/scratch/software/clang-trunk/bin/clang-13+0x5c316ca)
#19 0x00005645db500649 clang::Parser::ParseCompoundStatementBody(bool) (/scratch/software/clang-trunk/bin/clang-13+0x5c32649)
#20 0x00005645db502c5a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/scratch/software/clang-trunk/bin/clang-13+0x5c34c5a)
#21 0x00005645db448ef2 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/scratch/software/clang-trunk/bin/clang-13+0x5b7aef2)
#22 0x00005645db475850 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/scratch/software/clang-trunk/bin/clang-13+0x5ba7850)
#23 0x00005645db4436f6 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/scratch/software/clang-trunk/bin/clang-13+0x5b756f6)
#24 0x00005645db443ce1 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#25 0x00005645db44a4e7 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/scratch/software/clang-trunk/bin/clang-13+0x5b7c4e7)
#26 0x00005645db44ba7e clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/scratch/software/clang-trunk/bin/clang-13+0x5b7da7e)
#27 0x00005645db44be29 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/scratch/software/clang-trunk/bin/clang-13+0x5b7de29)
#28 0x00005645db43e29a clang::ParseAST(clang::Sema&, bool, bool) (/scratch/software/clang-trunk/bin/clang-13+0x5b7029a)
#29 0x00005645da385968 clang::CodeGenAction::ExecuteAction() (/scratch/software/clang-trunk/bin/clang-13+0x4ab7968)
#30 0x00005645d9c35599 clang::FrontendAction::Execute() (/scratch/software/clang-trunk/bin/clang-13+0x4367599)
#31 0x00005645d9bc87e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/scratch/software/clang-trunk/bin/clang-13+0x42fa7e6)
#32 0x00005645d9d13480 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/scratch/software/clang-trunk/bin/clang-13+0x4445480)
#33 0x00005645d6b33696 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/scratch/software/clang-trunk/bin/clang-13+0x1265696)
#34 0x00005645d6b2f9d8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#35 0x00005645d6a5d0e6 main (/scratch/software/clang-trunk/bin/clang-13+0x118f0e6)
#36 0x00007fa90be990b3 __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#37 0x00005645d6b2f54e _start (/scratch/software/clang-trunk/bin/clang-13+0x126154e)
clang-13: error: unable to execute command: Aborted (core dumped)
clang-13: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git 2e9c75daffddd65e37c3236708b5b133e6f5f2f5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/cnsun/usr/bin
clang-13: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/mutant-d3de8a.c
clang-13: note: diagnostic msg: /tmp/mutant-d3de8a.sh
clang-13: note: diagnostic msg:

********************
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash-on-invalid confirmed Verified by a second party and removed clang Clang issues not falling into any other category labels Jun 5, 2023
@Endilll
Copy link
Contributor

Endilll commented Jun 5, 2023

Assertions build is still crashing: https://godbolt.org/z/n6jTbEW48
Diagnostics:

<source>:1:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
    1 | p() {
      | ^
      | int
<source>:2:18: error: member reference base type 'int ()' is not a structure or union
    2 | unsigned x[] = {p->a};
      |                 ~^ ~

Assertion:

clang: /root/llvm-project/clang/lib/Sema/SemaCast.cpp:2902: void {anonymous}::CastOperation::CheckCStyleCast(): Assertion `(DestType->containsErrors() || SrcExpr.get()->containsErrors() || SrcExpr.get()->containsErrors()) && "should only occur in error-recovery path."' failed.

Stack:

0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<source>:3:12: current parser token ';'
2.	<source>:1:5: parsing function body 'p'
3.	<source>:1:5: in compound statement ('{}')
 #0 0x0000556453022dbf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c12dbf)
 #1 0x0000556453020b2c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c10b2c)
 #2 0x0000556452f6a1a8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007fc5dad8c420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007fc5da85900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007fc5da838859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007fc5da838729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007fc5da849fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055645591ba1a (anonymous namespace)::CastOperation::CheckCStyleCast() SemaCast.cpp:0:0
 #9 0x000055645591e8cd clang::Sema::BuildCStyleCastExpr(clang::SourceLocation, clang::TypeSourceInfo*, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x650e8cd)
#10 0x0000556455d0805c clang::Sema::ActOnCastExpr(clang::Scope*, clang::SourceLocation, clang::Declarator&, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x68f805c)
#11 0x00005564557df684 clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63cf684)
#12 0x00005564557d44a6 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c44a6)
#13 0x00005564557d638b clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c638b)
#14 0x00005564557d643d clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63c643d)
#15 0x00005564557da5fd clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63ca5fd)
#16 0x0000556455858a40 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6448a40)
#17 0x000055645584ee13 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x643ee13)
#18 0x000055645584fd11 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x643fd11)
#19 0x0000556455850d09 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6440d09)
#20 0x00005564558526ba clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x64426ba)
#21 0x000055645577d421 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x636d421)
#22 0x00005564557a42f0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63942f0)
#23 0x0000556455770cc1 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6360cc1)
#24 0x000055645577157f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#25 0x0000556455777f21 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6367f21)
#26 0x0000556455778896 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6368896)
#27 0x0000556455778d34 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6368d34)
#28 0x000055645576c62a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x635c62a)
#29 0x00005564542707c8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4e607c8)
#30 0x0000556453ac7f09 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x46b7f09)
#31 0x0000556453a4c3d6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x463c3d6)
#32 0x0000556453baa9e6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x479a9e6)
#33 0x00005564504de46d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10ce46d)
#34 0x00005564504da16a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#35 0x00005564538b439d 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
#36 0x0000556452f6a6b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b5a6b0)
#37 0x00005564538b49bf 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
#38 0x000055645387c0ec clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x446c0ec)
#39 0x000055645387cb7d 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+0x446cb7d)
#40 0x0000556453884c5d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4474c5d)
#41 0x00005564504dc6ca clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10cc6ca)
#42 0x00005564503e3235 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xfd3235)
#43 0x00007fc5da83a083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#44 0x00005564504d4f4e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10c4f4e)

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 5, 2023

@llvm/issue-subscribers-clang-frontend

@hokein hokein self-assigned this Jul 8, 2023
@hokein hokein closed this as completed in 9ca395b Jul 11, 2023
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Jul 19, 2023
  [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes llvm/llvm-project#50236
  Fixes llvm/llvm-project#50243
  Fixes llvm/llvm-project#48636
  Fixes llvm/llvm-project#50320

  Differential Revision: https://reviews.llvm.org/D154861

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by:	dstolfa
PR:		271047
MFC after:	1 month
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Jul 23, 2023
  [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes llvm/llvm-project#50236
  Fixes llvm/llvm-project#50243
  Fixes llvm/llvm-project#48636
  Fixes llvm/llvm-project#50320

  Differential Revision: https://reviews.llvm.org/D154861

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by:	dstolfa
PR:		271047
MFC after:	1 month

(cherry picked from commit 8d0cab8)
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this issue Sep 6, 2023
  [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes llvm/llvm-project#50236
  Fixes llvm/llvm-project#50243
  Fixes llvm/llvm-project#48636
  Fixes llvm/llvm-project#50320

  Differential Revision: https://reviews.llvm.org/D154861

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by:	dstolfa
PR:		271047
MFC after:	1 month
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-invalid
Projects
None yet
Development

No branches or pull requests

4 participants