<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ICE when performing binary operation on consteval result and consteval member result"
   href="https://bugs.llvm.org/show_bug.cgi?id=48235">48235</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ICE when performing binary operation on consteval result and consteval member result
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>robin@voetter.nl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24188" name="attach_24188" title="Script which clang produced">attachment 24188</a> <a href="attachment.cgi?id=24188&action=edit" title="Script which clang produced">[details]</a></span>
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 <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> 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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>