[cfe-dev] [llvm-dev] trivial input provokes failed assertion in Parser.h:322

Shoaib Meenai via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 2 22:51:47 PDT 2018


Adding cfe-dev, since this is a clang issue.

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Jim Meyering via llvm-dev <llvm-dev at lists.llvm.org>
Reply-To: Jim Meyering <jim at meyering.net>
Date: Monday, April 2, 2018 at 8:40 PM
To: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org>
Subject: [llvm-dev] trivial input provokes failed assertion in Parser.h:322

While attempting to reduce a ubsan-specific bug, I stumbled upon the following.
[I would have filed a bug report, but don't have an account, and so
requested one per https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.llvm.org_&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=R7rHNXVz33pSWF-LHSh3QPvscmWjtF3epbTUw2ufAVc&s=RfIC9dWnWb3gOLdPM-6SkfL2fbaalJuQueD53kQUo2Y&e= about 7 hours ago -- but
still no response, so am sending this instead. ]
Using clang built from latest master of about 5 hours ago:

$ echo struct a typename a | clang -x c++ -
<stdin>:1:19: error: expected a qualified name after 'typename'
struct a typename a
                  ^
<stdin>:1:19: error: cannot combine with previous 'struct' declaration specifier
clang-7: ../tools/clang/include/clang/Parse/Parser.h:322:
clang::SourceLocation clang::Parser::ConsumeToken(): Assertion
`!isTokenSpecial() && "Should consume special tokens with
Consume*Token"' failed.
#0 0x0000000000e7cf57 __interceptor_backtrace (/dev/shm/c3/bin/clang-7+0xe7cf57)
#1 0x0000000002efc913 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/data/users/meyering/fbsource/fbcode/llvm/build/../lib/Support/Unix/Signals.inc:398:13
#2 0x0000000002efa0d5 llvm::sys::RunSignalHandlers()
/data/users/meyering/fbsource/fbcode/llvm/lib/Support/Signals.cpp:49:16
#3 0x0000000002efd13b SignalHandler(int)
/data/users/meyering/fbsource/fbcode/llvm/build/../lib/Support/Unix/Signals.inc:242:3
#4 0x00007f72e1ce0ad0 __restore_rt
(/usr/local/fbcode/gcc-5-glibc-2.23/lib/libpthread.so.0+0x11ad0)
#5 0x00007f72e08387c8 __GI_raise
/home/engshare/third-party2/glibc/2.23/src/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#6 0x00007f72e083a591 __GI_abort
/home/engshare/third-party2/glibc/2.23/src/glibc-2.23/stdlib/abort.c:91:0
#7 0x00007f72e0830d15 __assert_fail_base
/home/engshare/third-party2/glibc/2.23/src/glibc-2.23/assert/assert.c:92:0
#8 0x00007f72e0830dc3 (/usr/local/fbcode/gcc-5-glibc-2.23/lib/libc.so.6+0x2ddc3)
#9 0x0000000005c811c6 clang::Parser::ConsumeToken()
/data/users/meyering/fbsource/fbcode/llvm/build/../tools/clang/include/clang/Parse/Parser.h:324:5
#10 0x0000000005caa09b
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/ParseDecl.cpp:0:7
#11 0x0000000005c79d61
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/Parser.cpp:922:3
#12 0x0000000005c797e4
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/Parser.cpp:1028:12
#13 0x0000000005c782c0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/Parser.cpp:853:12
#14 0x0000000005c77143
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/Parser.cpp:609:10
#15 0x0000000005c76c2f
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/Parser.cpp:535:26
#16 0x0000000005c70f83 clang::ParseAST(clang::Sema&, bool, bool)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Parse/ParseAST.cpp:151:3
#17 0x0000000004621c94 clang::CodeGenAction::ExecuteAction()
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:1
#18 0x0000000003dff1d2 clang::FrontendAction::Execute()
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:908:10
#19 0x0000000003d69d87
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:990:11
#20 0x0000000003f83d38
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:255:25
#21 0x0000000000f7ff51 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) /data/users/meyering/fbsource/fbcode/llvm/tools/clang/tools/driver/cc1_main.cpp:221:13
#22 0x0000000000f70133 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/tools/driver/driver.cpp:310:12
#23 0x0000000000f6fdb8 main
/data/users/meyering/fbsource/fbcode/llvm/tools/clang/tools/driver/driver.cpp:390:12
#24 0x00007f72e0823858 __libc_start_main
/home/engshare/third-party2/glibc/2.23/src/glibc-2.23/csu/../csu/libc-start.c:323:0
#25 0x0000000000e4e659 _start
/home/engshare/third-party2/glibc/2.23/src/glibc-2.23/csu/../sysdeps/x86_64/start.S:121:0
Stack dump:
0.      Program arguments: /dev/shm/c3/bin/clang-7 -cc1 -triple
x86_64-facebook-linux -emit-obj -mrelax-all -disable-free
-main-file-name - -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -resource-dir /dev/shm/c3/lib/clang/7.0.0
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
-internal-isystem /usr/local/include -internal-isystem
/dev/shm/c3/lib/clang/7.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /data/users/meyering/x -ferror-limit 19
-fmessage-length 252 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/dev/shm/jt-3wYtRx/--8fb7b9.o -x c++ -
1.      <stdin>:1:19: at annotation token
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to
see invocation)
clang version 7.0.0
(ssh://git.vip.facebook.com/data/gitrepos/llvm/clang.git
eadc8a81ef3df4c986bd9b0f6676e0e49646fa0f) (llvm/llvm.git
755a2196409460fc1f29f638a005d2d43948eb45)
Target: x86_64-facebook-linux
Thread model: posix
InstalledDir: /t/c3/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.llvm.org_&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=R7rHNXVz33pSWF-LHSh3QPvscmWjtF3epbTUw2ufAVc&s=RfIC9dWnWb3gOLdPM-6SkfL2fbaalJuQueD53kQUo2Y&e= and include the crash backtrace, preprocessed
source, and associated run script.
clang-7: note: diagnostic msg: Error generating preprocessed source(s)
- ignoring input from stdin.
clang-7: note: diagnostic msg: Error generating preprocessed source(s)
- no preprocessable inputs.
[Exit 254 (126)]
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=R7rHNXVz33pSWF-LHSh3QPvscmWjtF3epbTUw2ufAVc&s=CWV47WzQrJnJCLftlO3UNi7CdeOr_ToUBErn9K79L6g&e=

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180403/17b33c83/attachment.html>


More information about the cfe-dev mailing list