<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 - Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=46419">46419</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>crash-on-invalid
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>haoxintu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed.
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=46419#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=46419">bug 46419</a>
from <span class="vcard"><a class="email" href="mailto:haoxintu@gmail.com" title="Haoxin Tu <haoxintu@gmail.com>"> <span class="fn">Haoxin Tu</span></a>
</span></b>
<pre>Add assertion information.
clang-11:
/home/haoxin/corpus-compilers/llvm-trunk/llvm-project-master-assert/clang/include/clang/Sema/DeclSpec.h:501:
clang::Expr *clang::DeclSpec::getRepAsExpr() const: Assertion `isExprRep((TST)
TypeSpecType) && "DeclSpec does not store an expr"' failed.</pre>
</div>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=46419#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang crash : Assertion `isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr"' failed."
href="https://bugs.llvm.org/show_bug.cgi?id=46419">bug 46419</a>
from <span class="vcard"><a class="email" href="mailto:haoxintu@gmail.com" title="Haoxin Tu <haoxintu@gmail.com>"> <span class="fn">Haoxin Tu</span></a>
</span></b>
<pre>Noted that this case is reduced by C-Reduce.
And another case
a(){
= b.decltype(auto)
It also reproduced this issue. Although the StackTrace is different in some
way, I think it's the same issue.</pre>
</div>
<div>
<pre>This code, bug.cc, it's an invalid code but crashes Clang.
$cat bug.cc
a = b.~decltype(auto)
$clang++ bug.cc
bug.cc:1:1: error: C++ requires a type specifier for all declarations
a = b.~decltype(auto)
^
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:
/home/haoxin/compilers/llvm-clang/llvm-project/build/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 bug.cc
-mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/haoxin/compilers/llvm-clang/llvm-project/build/lib/clang/11.0.0
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/home/haoxin/compilers/llvm-clang/llvm-project/build/lib/clang/11.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/haoxin/test -ferror-limit 19
-fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -faddrsig -o
/tmp/bug-4b5eb6.o -x c++ bug.cc
1. <eof> parser at end of file
#0 0x0000555d7095e7da llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x2b697da)
#1 0x0000555d7095c5a4 llvm::sys::RunSignalHandlers()
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x2b675a4)
#2 0x0000555d7095c6f3 SignalHandler(int)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x2b676f3)
#3 0x00007f3f60cf7890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x0000555d728f1504 clang::Sema::BuildDecltypeType(clang::Expr*,
clang::SourceLocation, bool)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x4afc504)
#5 0x0000555d7259d86f clang::Sema::ActOnPseudoDestructorExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec const&)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x47a886f)
#6 0x0000555d721f3593 clang::Parser::ParseCXXPseudoDestructor(clang::Expr*,
clang::SourceLocation, clang::tok::TokenKind, clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43fe593)
#7 0x0000555d721e78b0
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43f28b0)
#8 0x0000555d721e21f5
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43ed1f5)
#9 0x0000555d721e4936
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43ef936)
#10 0x0000555d721e5bd4
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43f0bd4)
#11 0x0000555d721b0c22
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43bbc22)
#12 0x0000555d721c3895 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43ce895)
#13 0x0000555d7219a809
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43a5809)
#14 0x0000555d7219b501
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.227)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43a6501)
#15 0x0000555d721a13e9
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43ac3e9)
#16 0x0000555d721a2af9
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43adaf9)
#17 0x0000555d721a3155
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43ae155)
#18 0x0000555d72196733 clang::ParseAST(clang::Sema&, bool, bool)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x43a1733)
#19 0x0000555d71140a79 clang::FrontendAction::Execute()
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x334ba79)
#20 0x0000555d710fbc43
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x3306c43)
#21 0x0000555d712055ab
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0x34105ab)
#22 0x0000555d6eba74ec cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0xdb24ec)
#23 0x0000555d6eba411d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0xdaf11d)
#24 0x0000555d6eaf2911 main
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0xcfd911)
#25 0x00007f3f5f940b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#26 0x0000555d6eba3c9a _start
(/home/haoxin/compilers/llvm-clang/llvm-project/build/bin/clang-11+0xdaec9a)
clang-11: error: unable to execute command: Segmentation fault (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
e6aba43cda848f4a8cfa5ce9f174b77def10e9df)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-clang/llvm-project/build/bin
clang-11: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-11: note: diagnostic msg: /tmp/bug-d5447c.cpp
clang-11: note: diagnostic msg: /tmp/bug-d5447c.sh
clang-11: note: diagnostic msg:
********************
$clang++ --version
clang version 11.0.0 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
e6aba43cda848f4a8cfa5ce9f174b77def10e9df)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-clang/llvm-project/build/bin
Reproduced in newer trunk : <a href="https://godbolt.org/z/z6EzeH">https://godbolt.org/z/z6EzeH</a></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>