[llvm-bugs] [Bug 50890] New: ICE on valid code: clang::CodeGen::LValue clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr*): Assertion `E->isNonOdrUse() != NOUR_Unevaluated && "should not emit an unevaluated operand"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 26 13:27:37 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50890

            Bug ID: 50890
           Summary: ICE on valid code: clang::CodeGen::LValue
                    clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(con
                    st clang::DeclRefExpr*): Assertion `E->isNonOdrUse()
                    != NOUR_Unevaluated && "should not emit an unevaluated
                    operand"' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cnsun at uwaterloo.ca
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

$ 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
a() {
  int i;
  sizeof(typeof(*(char(*)[i])a));
}

$ clang-trunk  mutant.c
mutant.c:1:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
a() {
^
mutant.c:3:3: warning: expression result unused [-Wunused-value]
  sizeof(typeof(*(char(*)[i])a));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mutant.c:4:1: warning: non-void function does not return a value
[-Wreturn-type]
}
^
clang-13:
/tmp/tmp.xjN6dMkdrg-clang-builder/llvm-project/clang/lib/CodeGen/CGExpr.cpp:2673:
clang::CodeGen::LValue clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const
clang::DeclRefExpr*): Assertion `E->isNonOdrUse() != NOUR_Unevaluated &&
"should not emit an unevaluated operand"' 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_002416_09bd/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_002416_09bd/delta/perses_result
-ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1
-o /tmp/mutant-d0aad4.o -x c mutant.c
1.      <eof> parser at end of file
2.      mutant.c:1:1: LLVM IR generation of declaration 'a'
3.      mutant.c:1:1: Generating code for declaration 'a'
 #0 0x000055763303e184 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x000055763303b93e SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f32abe3d3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #3 0x00007f32ab8dc18b raise
/build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007f32ab8bb859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007f32ab8bb729 get_sysdep_segment_value
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007f32ab8bb729 _nl_load_domain
/build/glibc-ZN95T4/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007f32ab8ccf36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
 #8 0x00005576336e33ff
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*)
(/scratch/software/clang-trunk/bin/clang-13+0x40003ff)
 #9 0x00005576336ddb09 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/scratch/software/clang-trunk/bin/clang-13+0x3ffab09)
#10 0x000055763372aa74 (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*)
CGExprScalar.cpp:0:0
#11 0x000055763372192e (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#12 0x000055763372396a
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x404096a)
#13 0x00005576336e377a
clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*)
(/scratch/software/clang-trunk/bin/clang-13+0x400077a)
#14 0x00005576336e38c9
clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*,
clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*)
(/scratch/software/clang-trunk/bin/clang-13+0x40008c9)
#15 0x00005576336e8d0a
clang::CodeGen::CodeGenFunction::EmitUnaryOpLValue(clang::UnaryOperator const*)
(.part.0) CGExpr.cpp:0:0
#16 0x00005576336e91c1
clang::CodeGen::CodeGenFunction::EmitUnaryOpLValue(clang::UnaryOperator const*)
(/scratch/software/clang-trunk/bin/clang-13+0x40061c1)
#17 0x00005576336ddb42 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/scratch/software/clang-trunk/bin/clang-13+0x3ffab42)
#18 0x00005576336dd598 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr
const*) (/scratch/software/clang-trunk/bin/clang-13+0x3ffa598)
#19 0x00005576336e958f
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/scratch/software/clang-trunk/bin/clang-13+0x400658f)
#20 0x0000557633435c7c
clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(clang::QualType)
(/scratch/software/clang-trunk/bin/clang-13+0x3d52c7c)
#21 0x0000557633710a1d (anonymous
namespace)::ScalarExprEmitter::VisitUnaryExprOrTypeTraitExpr(clang::UnaryExprOrTypeTraitExpr
const*) (.isra.0) CGExprScalar.cpp:0:0
#22 0x000055763372213c (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#23 0x000055763372396a
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x404096a)
#24 0x00005576336cac57 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x3fe7c57)
#25 0x00005576336e95ce
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/scratch/software/clang-trunk/bin/clang-13+0x40065ce)
#26 0x00005576333cdd1a clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/scratch/software/clang-trunk/bin/clang-13+0x3cead1a)
#27 0x00005576333d40bc
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/scratch/software/clang-trunk/bin/clang-13+0x3cf10bc)
#28 0x000055763342b501
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/scratch/software/clang-trunk/bin/clang-13+0x3d48501)
#29 0x000055763343cd5c
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/scratch/software/clang-trunk/bin/clang-13+0x3d59d5c)
#30 0x00005576334963f6
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/scratch/software/clang-trunk/bin/clang-13+0x3db33f6)
#31 0x0000557633491f45
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/scratch/software/clang-trunk/bin/clang-13+0x3daef45)
#32 0x00005576334923ab
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/scratch/software/clang-trunk/bin/clang-13+0x3daf3ab)
#33 0x000055763349ae62
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0)
CodeGenModule.cpp:0:0
#34 0x000055763419d7e9 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
ModuleBuilder.cpp:0:0
#35 0x000055763418f9d0
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/scratch/software/clang-trunk/bin/clang-13+0x4aac9d0)
#36 0x00005576352532b4 clang::ParseAST(clang::Sema&, bool, bool)
(/scratch/software/clang-trunk/bin/clang-13+0x5b702b4)
#37 0x000055763419a968 clang::CodeGenAction::ExecuteAction()
(/scratch/software/clang-trunk/bin/clang-13+0x4ab7968)
#38 0x0000557633a4a599 clang::FrontendAction::Execute()
(/scratch/software/clang-trunk/bin/clang-13+0x4367599)
#39 0x00005576339dd7e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/scratch/software/clang-trunk/bin/clang-13+0x42fa7e6)
#40 0x0000557633b28480
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/scratch/software/clang-trunk/bin/clang-13+0x4445480)
#41 0x0000557630948696 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/scratch/software/clang-trunk/bin/clang-13+0x1265696)
#42 0x00005576309449d8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#43 0x00005576308720e6 main
(/scratch/software/clang-trunk/bin/clang-13+0x118f0e6)
#44 0x00007f32ab8bd0b3 __libc_start_main
/build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
#45 0x000055763094454e _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-a4b180.c
clang-13: note: diagnostic msg: /tmp/mutant-a4b180.sh
clang-13: note: diagnostic msg:

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210626/3678d404/attachment-0001.html>


More information about the llvm-bugs mailing list