Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Nested decltype() crashes the frontend #12673

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR12562
Status NEW
Importance P normal
Reported by llvm-bugs@quasiparticle.net
Reported on 2012-04-15 11:25:11 -0700
Last modified on 2012-07-14 18:48:47 -0700
Version trunk
Hardware PC Linux
CC llvm-bugs@lists.llvm.org, william@lynch.us
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
This crashes the frontend:

int main() {
  decltype(decltype(1)()) x;
}

Invocation and errors:

% clang++ -std=c++11 -ofoo bar.cpp -Wall
Stack dump:
0.  Program arguments: /usr/bin/clang-3.1 -cc1 -triple x86_64-unknown-linux-gnu -
emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
bar.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-
aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -resource-
dir /usr/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -
internal-isystem /usr/bin/../lib/gcc/x86_64-unknown-linux-
gnu/4.7.0/../../../../include/c++/4.7.0 -internal-isystem
/usr/bin/../lib/gcc/x86_64-unknown-linux-
gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu -internal-
isystem /usr/bin/../lib/gcc/x86_64-unknown-linux-
gnu/4.7.0/../../../../include/c++/4.7.0/backward -internal-isystem
/usr/local/include -internal-isystem /usr/bin/../lib/clang/3.1/include -
internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -
std=c++11 -fdeprecated-macro -fdebug-compilation-dir /dev/shm -ferror-limit 19 -
fmessage-length 68 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-
runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-
show-option -fcolor-diagnostics -o /tmp/bar-dhKLFf.o -x c++ bar.cpp
1.  <eof> parser at end of file
2.  bar.cpp:2:1: parsing function body 'main'
clang-3: error: unable to execute command: Segmentation fault (core dumped)
clang-3: error: clang frontend command failed due to signal (use -v to see
invocation)
clang-3: note: diagnostic msg: Please submit a bug report to  and include
command line arguments and all diagnostic information.
clang-3: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang-3: note: diagnostic msg: /tmp/bar-OnVTVb.ii
clang-3: note: diagnostic msg: /tmp/bar-OnVTVb.sh

And once again, it's the -Wall that breaks it for me. Remove it, the code
compiles. Leave it there, the frontend dies. It's a fresh build from svn
(r154763). I can't make any sense of it, clang 3.0 runs fine with and without -
Wall, but it does not compile the code. Instead, it dies at the inner decltype
expecting an expression.
Not using -Wall, but -Weverything, doesn't trigger this. I can reproduce this
on multiple machines. Maybe someone else this time, too?
Quuxplusone commented 12 years ago
On LLVM 3.1, I can not reproduce this.

[6:46pm][wlynch@apple /tmp] cat foo.cc
int main() {
    decltype(decltype(1)()) x;
}
[6:46pm][wlynch@apple /tmp] /opt/llvm/3.1/bin/clang++ -std=c++11 -o foo foo.cc -
Wall
foo.cc:2:26: warning: unused variable 'x' [-Wunused-variable]
        decltype(decltype(1)()) x;
                                ^
1 warning generated.