[llvm-bugs] [Bug 44960] New: Assertion `E->isRValue() && "missing lvalue-to-rvalue conv in bool condition"

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 18 14:53:47 PST 2020


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

            Bug ID: 44960
           Summary: Assertion `E->isRValue() && "missing lvalue-to-rvalue
                    conv in bool condition"
           Product: new-bugs
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: bero at lindev.ch
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 23143
  --> https://bugs.llvm.org/attachment.cgi?id=23143&action=edit
Reduced test case

Trying to build the attached piece of code (extracted from gjs) with clang++
10.0-rc2 results in an assertion failure.

The attached code is already reduced (but creduce messed it up slightly because
it crashed with the same assertion error -- not a surprise given it uses LLVM
libraries).

$ clang++ -o bug.o bug.cpp
bug.cpp:1:20: error: C++ requires a type specifier for all declarations
template <class a> b() {
                   ^
bug.cpp:6:25: error: expected ';' after expression
                       d d
                        ^
                        ;                                                       
bug.cpp:6:24: warning: expression result unused [-Wunused-value]
                       d d
                       ^
bug.cpp:6:27: error: expected ';' after expression
                       d d
                          ^
                          ;                                                     
bug.cpp:8:22: error: expected ';' after expression
                   1)
                     ^
                     ;                                                          
bug.cpp:3:3: warning: ignoring return value of function declared with const
attribute [-Wunused-value]
  __builtin_expect(({
  ^~~~~~~~~~~~~~~~ ~~
clang-10:
/builddir/build/BUILD/llvm-project-release-10.x/clang/lib/AST/ExprConstant.cpp:2326:
bool EvaluateAsBooleanCondition(const clang::Expr *, bool &, (anonymous
namespace)::EvalInfo &): Assertion `E->isRValue() && "missing lvalue-to-rvalue
conv in bool condition"' failed.
Stack dump:
0.      Program arguments: /usr/bin/clang-10 -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -main-file-name bug.cpp -mrelocation-model
static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/usr/lib64/clang/10.0.0 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/10.0.0/../../../../include/c++/10.0.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/10.0.0/../../../../include/c++/10.0.0/x86_64-openmandriva-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-openmandriva-linux-gnu/10.0.0/../../../../include/c++/10.0.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib64/clang/10.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/bero/temp/abf/gjs/BUILD/gjs-1.58.5 -ferror-limit
19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o
/tmp/bug-18832a.o -x c++ bug.cpp 
1.      <eof> parser at end of file
2.      bug.cpp:1:24: parsing function body 'b'
3.      bug.cpp:1:24: in compound statement ('{}')
 #0 0x00007f9853752f02 (/usr/lib64/libLLVMSupport.so.10.0+0x21bf02)
 #1 0x00007f98537504ae llvm::sys::RunSignalHandlers()
(/usr/lib64/libLLVMSupport.so.10.0+0x2194ae)
 #2 0x00007f9853753128 (/usr/lib64/libLLVMSupport.so.10.0+0x21c128)
 #3 0x00007f98531ad980 __restore_rt (/lib64/libc.so.6+0x44980)
 #4 0x00007f98531ad8f7 raise (/lib64/libc.so.6+0x448f7)
 #5 0x00007f985318e53d abort (/lib64/libc.so.6+0x2553d)
 #6 0x00007f985318e411 _nl_load_domain.cold (/lib64/libc.so.6+0x25411)
 #7 0x00007f985319e912 (/lib64/libc.so.6+0x35912)
 #8 0x00007f9851ef71c9 (/usr/lib64/libclangAST.so.10.0+0x5201c9)
 #9 0x00007f9851f04ae4 (/usr/lib64/libclangAST.so.10.0+0x52dae4)
#10 0x00007f9851f11565 (/usr/lib64/libclangAST.so.10.0+0x53a565)
#11 0x00007f9851ed8a3b (/usr/lib64/libclangAST.so.10.0+0x501a3b)
#12 0x00007f9851edba67 (/usr/lib64/libclangAST.so.10.0+0x504a67)
#13 0x00007f9851ed6ba9 clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const (/usr/lib64/libclangAST.so.10.0+0x4ffba9)
#14 0x00007f9850d2e72b (/usr/lib64/libclangSema.so.10.0+0x3d672b)
#15 0x00007f9850d280b6 (/usr/lib64/libclangSema.so.10.0+0x3d00b6)
#16 0x00007f9850d19096 (/usr/lib64/libclangSema.so.10.0+0x3c1096)
#17 0x00007f9850d19b63 (/usr/lib64/libclangSema.so.10.0+0x3c1b63)
#18 0x00007f9850d1a79a clang::Sema::CheckCompletedExpr(clang::Expr*,
clang::SourceLocation, bool) (/usr/lib64/libclangSema.so.10.0+0x3c279a)
#19 0x00007f98510ac019 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool) (/usr/lib64/libclangSema.so.10.0+0x754019)
#20 0x00007f98512a59e1
clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool)
(/usr/lib64/libclangSema.so.10.0+0x94d9e1)
#21 0x00007f98515f428a
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
(/usr/lib64/libclangParse.so.10.0+0x11928a)
#22 0x00007f98515f2a95
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/lib64/libclangParse.so.10.0+0x117a95)
#23 0x00007f98515f2488
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
(/usr/lib64/libclangParse.so.10.0+0x117488)
#24 0x00007f98515fb626 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/lib64/libclangParse.so.10.0+0x120626)
#25 0x00007f98515fc6bb clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/lib64/libclangParse.so.10.0+0x1216bb)
#26 0x00007f985161acc0
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/lib64/libclangParse.so.10.0+0x13fcc0)
#27 0x00007f98516068ee
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib64/libclangParse.so.10.0+0x12b8ee)
#28 0x00007f9851604fd1
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib64/libclangParse.so.10.0+0x129fd1)
#29 0x00007f9851604750
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/lib64/libclangParse.so.10.0+0x129750)
#30 0x00007f985155b256
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*) (/usr/lib64/libclangParse.so.10.0+0x80256)
#31 0x00007f9851617bf0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib64/libclangParse.so.10.0+0x13cbf0)
#32 0x00007f98516162eb
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/usr/lib64/libclangParse.so.10.0+0x13b2eb)
#33 0x00007f9851615c87
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib64/libclangParse.so.10.0+0x13ac87)
#34 0x00007f98515477b5 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib64/libclangParse.so.10.0+0x6c7b5)
#35 0x00007f98567fd285 clang::CodeGenAction::ExecuteAction()
(/usr/lib64/libclangCodeGen.so.10.0+0x594285)
#36 0x00007f9854f9ccdd clang::FrontendAction::Execute()
(/usr/lib64/libclangFrontend.so.10.0+0x174cdd)
#37 0x00007f9854f2219a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib64/libclangFrontend.so.10.0+0xfa19a)
#38 0x00007f985722f9b4
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib64/libclangFrontendTool.so.10.0+0x59b4)
#39 0x00000000002180d0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-10+0x2180d0)
#40 0x0000000000215fe1 (/usr/bin/clang-10+0x215fe1)
#41 0x00000000002155a1 main (/usr/bin/clang-10+0x2155a1)
#42 0x00007f985318fdbb __libc_start_main (/lib64/libc.so.6+0x26dbb)
#43 0x0000000000211a2a _start (/usr/bin/clang-10+0x211a2a)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/bug-ef414d.cpp
clang-10: note: diagnostic msg: /tmp/bug-ef414d.sh
clang-10: 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/20200218/774a4577/attachment.html>


More information about the llvm-bugs mailing list