[LLVMbugs] [Bug 19968] New: clang segfaults when parsing illegal c++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 6 08:08:42 PDT 2014


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

            Bug ID: 19968
           Summary: clang segfaults when parsing illegal c++
           Product: clang
           Version: 3.4
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: spam_hole at shaw.ca
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang version:

    Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
    Target: x86_64-apple-darwin13.2.0
    Thread model: posix

Clang segfaults on the following (illegal) code snippet:

    inline void* operator new (.::size_t) {

It doesn't matter that this has no closing brace, because Clang's parser
doesn't get that far. It crashes:

    foo.ii:1:28: error: expected parameter declarator
    inline void* operator new (.::size_t) {
                               ^
    foo.ii:1:28: error: expected ')'
    foo.ii:1:27: note: to match this '('
    inline void* operator new (.::size_t) {
                              ^
    Stack dump:
    0.    Program arguments:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name foo.ii -mrelocation-model pic -pic-level
2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 236.3 -resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1
-fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 231 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o
/var/folders/gf/l1sssgds0b30z21wn2n4p3rm0000gr/T/foo-bf57b7.o -x c++-cpp-output
foo.ii 
    1.    foo.ii:1:39: current parser token '{'
    clang: error: unable to execute command: Segmentation fault: 11
    clang: error: clang frontend command failed due to signal (use -v to see
invocation)
    Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
    Target: x86_64-apple-darwin13.2.0
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to
http://developer.apple.com/bugreporter/ and include the crash backtrace,
preprocessed source, and associated run script.
    clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140606/bd61fc35/attachment.html>


More information about the llvm-bugs mailing list