Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang::Parser::ParseDeclaratorInternal recursion crashing clang-4.0 #31562

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR32590
Status NEW
Importance P enhancement
Reported by mrdvlpr.xnu@gmail.com
Reported on 2017-04-10 03:28:58 -0700
Last modified on 2017-04-10 03:28:58 -0700
Version 4.0
Hardware PC Linux
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments test-8af20a.c (100030 bytes, text/x-csrc)
Blocks
Blocked by
See also
Created attachment 18255
Compiled file

The following command will crash clang-4.0 on ubuntu 16.04. (also 3.8 and 3.9)

$ python -c "print('*' * 99999)" > test.c && clang-4.0 test.c

Output of command:

#0 0x00007f1d6bef55e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1+0x70e5e8)
#1 0x00007f1d6bef376e llvm::sys::RunSignalHandlers() (/usr/lib/x86_64-linux-
gnu/libLLVM-4.0.so.1+0x70c76e)
#2 0x00007f1d6bef38bc (/usr/lib/x86_64-linux-gnu/libLLVM-4.0.so.1+0x70c8bc)
#3 0x00007f1d6e747390 __restore_rt (/lib/x86_64-linux-
gnu/libpthread.so.0+0x11390)
#4 0x0000000000efb36a clang::DeclSpec::Finish(clang::Sema&,
clang::PrintingPolicy const&) (/usr/lib/llvm-4.0/bin/clang+0xefb36a)
#5 0x0000000000d839b7
clang::Parser::ParseTypeQualifierListOpt(clang::DeclSpec&, unsigned int, bool,
bool) (/usr/lib/llvm-4.0/bin/clang+0xd839b7)
#6 0x0000000000d8442f
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8442f)
#7 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#8 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#9 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#10 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#11 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#12 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#13 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
#14 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
...
... (recursion output)
...
#255 0x0000000000d8445d
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (/usr/lib/llvm-4.0/bin/clang+0xd8445d)
Stack dump:
0.  Program arguments: /usr/lib/llvm-4.0/bin/clang -cc1 -triple x86_64-pc-linux-
gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-
names -main-file-name test.c -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 /usr/lib/llvm-4.0/bin/../lib/clang/4.0.0 -internal-
isystem /usr/local/include -internal-isystem /usr/lib/llvm-
4.0/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-
externc-isystem /usr/include -fdebug-compilation-dir /tmp -ferror-limit 19 -
fmessage-length 174 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-
diagnostics -o /tmp/test-73a5ff.o -x c test.c
1.  test.c:1:19371: current parser token '*'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0-svn297204-1~exp1 (branches/release_40)
Target: x86_64-pc-linux-gnu
Quuxplusone commented 7 years ago

Attached test-8af20a.c (100030 bytes, text/x-csrc): Compiled file