[LLVMbugs] [Bug 10487] New: Invalid C++ code crashes frontend

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 26 00:44:14 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10487

           Summary: Invalid C++ code crashes frontend
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: magnus.reftel at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6935)
 --> (http://llvm.org/bugs/attachment.cgi?id=6935)
Invalid C++ code that crashes the frontend

The attached (invalid) C++ code crashes clang++ in rev 136052 with the
following printouts. The problem has existed since at least rev 127028.

$ /opt/llvm-r136052/bin/clang++ invalid.cpp -fsyntax-only -v
clang version 3.0 (trunk 136052)
Target: i386-pc-cygwin
Thread model: posix
 "/opt/llvm-r136052/bin/clang" -cc1 -triple i386-pc-cygwin -fsyntax-only
-disable-free -main-file-name invalid.cpp -mrelocation-model static
-mdisable-fp-elim -mconstructor-aliases -target-cpu pentium4
-target-linker-version 2.20.51.20100410 -momit-leaf-frame-pointer -v
-resource-dir /opt/llvm-r136052/bin/../lib/clang/3.0 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 80 -fno-use-cxa-atexit -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ invalid.cpp
clang -cc1 version 3.0 based upon llvm 3.0svn hosted on i386-pc-cygwin
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/4.3.2/include/c++"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-cygwin/4.3.2/include/c++/i686-pc-cygwin"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-cygwin/4.3.2/include/c++/backward"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++
 /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/i686-pc-cygwin
 /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/backward
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/i686-pc-cygwin
 /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward
 /opt/llvm-r136052/bin/../lib/clang/3.0/include
 /usr/include/w32api
 /usr/include
End of search list.
invalid.cpp:3:24: error: C++ requires a type specifier for all declarations
        template<typename T1> f(T1 a) {
                              ^
invalid.cpp:4:3: error: use of undeclared identifier 'n2'
                n2::f<_> template<> s() {
                ^
invalid.cpp:4:9: error: use of undeclared identifier '_'
                n2::f<_> template<> s() {
                      ^
assertion "getCurFunctionDecl() == 0 && "Function parsing confused"" failed:
file "SemaTemplate.cpp", line 5114, function: clang::Decl*
clang::Sema::ActOnStartOfFunctionTemplateDef(clang::Scope*,
clang::MultiTemplateParamsArg, clang::Declarator&)
Stack dump:
0.      Program arguments: /opt/llvm-r136052/bin/clang -cc1 -triple
i386-pc-cygwin -fsyntax-only -disable-free -main-file-name invalid.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -target-cpu
pentium4 -target-linker-version 2.20.51.20100410 -momit-leaf-frame-pointer -v
-resource-dir /opt/llvm-r136052/bin/../lib/clang/3.0 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 80 -fno-use-cxa-atexit -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ invalid.cpp
1.      invalid.cpp:4:27: current parser token '{'
2.      invalid.cpp:2:1: parsing namespace 'n1'
3.      invalid.cpp:3:32: parsing function body 'f'
4.      invalid.cpp:3:32: in compound statement ('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list