[llvm-bugs] [Bug 48235] New: ICE when performing binary operation on consteval result and consteval member result

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 19 13:07:43 PST 2020


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

            Bug ID: 48235
           Summary: ICE when performing binary operation on consteval
                    result and consteval member result
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: robin at voetter.nl
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 24188
  --> https://bugs.llvm.org/attachment.cgi?id=24188&action=edit
Script which clang produced

The following code causes an ICE:

consteval int c() {
    return 1;
}

struct A {
    consteval int a() const {
        return 1;
    }

    void b() {
        this->a() + c();
    }
};

This does not seem to be a problem on clang 10. When c is not consteval, there
is no problem. When the call to c is replaced with another call to a(), the
same crash happens. (I only later realized that a consteval member is not
valid.)

test.cpp:11:19: warning: expression result unused [-Wunused-value]
        this->a() + c();
        ~~~~~~~~~ ^ ~~~
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: /usr/bin/clang-11 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name test.cpp
-mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/usr/lib/clang/11.0.0 -internal-isystem
/bin/../lib64/gcc/x86_64-unknown-linux-gnu/10.2/../../../../include/c++/10.2
-internal-isystem
/bin/../lib64/gcc/x86_64-unknown-linux-gnu/10.2/../../../../include/c++/10.2/x86_64-unknown-linux-gnu
-internal-isystem
/bin/../lib64/gcc/x86_64-unknown-linux-gnu/10.2/../../../../include/c++/10.2/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/clang/11.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++2a -fdeprecated-macro
-fdebug-compilation-dir /home/robin/programming/zooi -ferror-limit 19
-fgnuc-version=4.2.1 -fno-implicit-modules -fcxx-exceptions -fexceptions
-fcolor-diagnostics -faddrsig -o /tmp/test-3cc570.o -x c++ test.cpp
1.      <eof> parser at end of file
2.      test.cpp:5:1: parsing struct/union/class body 'A'
3.      test.cpp:10:14: parsing function body 'A::b'
 #0 0x00007feceece191a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/bin/../lib/libLLVM-11.so+0xb1891a)
 #1 0x00007feceecdf7e4 llvm::sys::RunSignalHandlers()
(/usr/bin/../lib/libLLVM-11.so+0xb167e4)
 #2 0x00007feceecdf928 (/usr/bin/../lib/libLLVM-11.so+0xb16928)
 #3 0x00007feceddd89b0 __restore_rt (/usr/bin/../lib/libc.so.6+0x3b9b0)
 #4 0x00007fecf4832708 clang::computeDependence(clang::CXXThisExpr*)
(/usr/bin/../lib/libclang-cpp.so.11+0xc29708)
 #5 0x00007fecf50f2222 clang::Sema::BuildCXXThisExpr(clang::SourceLocation,
clang::QualType, bool) (/usr/bin/../lib/libclang-cpp.so.11+0x14e9222)
 #6 0x00007fecf4ff5f43 (/usr/bin/../lib/libclang-cpp.so.11+0x13ecf43)
 #7 0x00007fecf50a8423 (/usr/bin/../lib/libclang-cpp.so.11+0x149f423)
 #8 0x00007fecf50a5c31 (/usr/bin/../lib/libclang-cpp.so.11+0x149cc31)
 #9 0x00007fecf5046cf7 clang::Sema::PopExpressionEvaluationContext()
(/usr/bin/../lib/libclang-cpp.so.11+0x143dcf7)
#10 0x00007fecf4e9d263 clang::Sema::ActOnFinishFunctionBody(clang::Decl*,
clang::Stmt*, bool) (/usr/bin/../lib/libclang-cpp.so.11+0x1294263)
#11 0x00007fecf46ae9dd clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/bin/../lib/libclang-cpp.so.11+0xaa59dd)
#12 0x00007fecf45ffc96
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
(/usr/bin/../lib/libclang-cpp.so.11+0x9f6c96)
#13 0x00007fecf45ff95d
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
(/usr/bin/../lib/libclang-cpp.so.11+0x9f695d)
#14 0x00007fecf463e4e4
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/usr/bin/../lib/libclang-cpp.so.11+0xa354e4)
#15 0x00007fecf4640b7b
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/bin/../lib/libclang-cpp.so.11+0xa37b7b)
#16 0x00007fecf461b3c5
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/bin/../lib/libclang-cpp.so.11+0xa123c5)
#17 0x00007fecf46c7bff
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/bin/../lib/libclang-cpp.so.11+0xabebff)
#18 0x00007fecf46c83c5 (/usr/bin/../lib/libclang-cpp.so.11+0xabf3c5)
#19 0x00007fecf46d0310
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/bin/../lib/libclang-cpp.so.11+0xac7310)
#20 0x00007fecf46d107d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/usr/bin/../lib/libclang-cpp.so.11+0xac807d)
#21 0x00007fecf45ff009 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/../lib/libclang-cpp.so.11+0x9f6009)
#22 0x00007fecf618b1a9 clang::FrontendAction::Execute()
(/usr/bin/../lib/libclang-cpp.so.11+0x25821a9)
#23 0x00007fecf613cbbb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/../lib/libclang-cpp.so.11+0x2533bbb)
#24 0x00007fecf62176e0
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/../lib/libclang-cpp.so.11+0x260e6e0)
#25 0x000055fe4792d98d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-11+0x1498d)
#26 0x000055fe4792b33b (/usr/bin/clang-11+0x1233b)
#27 0x000055fe4792808e main (/usr/bin/clang-11+0xf08e)
#28 0x00007feceddc3deb __libc_start_main
/builddir/glibc-2.30/csu/../csu/libc-start.c:342:3
#29 0x000055fe4792aeca _start (/usr/bin/clang-11+0x11eca)
clang-11: error: unable to execute command: Segmentation fault
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /bin

-- 
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/20201119/20c12b14/attachment.html>


More information about the llvm-bugs mailing list