[LLVMbugs] [Bug 20887] New: C++ frontend crashes on parsing '::' in class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 9 09:59:50 PDT 2014


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

            Bug ID: 20887
           Summary: C++ frontend crashes on parsing '::' in class
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lin90162 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

1.  Install clang with homebrew-versions

  $ brew install llvm35 --with-libcxx --with-clang --rtti

2. Prepare below broken code

    class X { a::a;

3. Compile it

  $ clang++-3.5 foo.cpp

4. Clang crashes and dump diagnostic message



Note that I can't reproduce this bug when trying it on Linux and when using
clang in XCode.
Output of clang++-3.5 --version is below.

clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

And I can reproduce the bug with clang 3.4.2.
The output of clang++-3.4 --version is below.

clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-apple-darwin13.3.0
Thread model: posix



A diagnostic message dumped by clang is below.

hoge.cpp:23:11: error: use of undeclared identifier 'a'
class X { a::a;
          ^
hoge.cpp:23:14: warning: access declarations are deprecated; use using
declarations instead [-Wdeprecated]
class X { a::a;
             ^
          using 
Assertion failed: (!SS.isInvalid() && "Invalid CXXScopeSpec."), function
BuildUsingDeclaration, file SemaDeclCXX.cpp, line 7577.
0  libLLVM-3.5.dylib        0x0000000107063733
llvm::sys::PrintStackTrace(__sFILE*) + 40
1  libLLVM-3.5.dylib        0x0000000107063b1e SignalHandler(int) + 248
2  libsystem_platform.dylib 0x00007fff900ba5aa _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1878284912
4  libLLVM-3.5.dylib        0x0000000107063985 abort + 22
5  libLLVM-3.5.dylib        0x000000010706396f abort + 0
6  clang                    0x0000000105f11f2a
llvm::SmallVectorImpl<clang::sema::DelayedDiagnostic>::operator=(llvm::SmallVectorImpl<clang::sema::DelayedDiagnostic>&&)
+ 102688
7  clang                    0x0000000105f11035
llvm::SmallVectorImpl<clang::sema::DelayedDiagnostic>::operator=(llvm::SmallVectorImpl<clang::sema::DelayedDiagnostic>&&)
+ 98859
8  clang                    0x0000000105de7438 void
std::__1::__tree_right_rotate<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*)
+ 124100
9  clang                    0x0000000105de5cca void
std::__1::__tree_right_rotate<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*)
+ 118102
10 clang                    0x0000000105de4e3b void
std::__1::__tree_right_rotate<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*)
+ 114375
11 clang                    0x0000000105dd392d void
std::__1::__tree_right_rotate<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*)
+ 43449
12 clang                    0x0000000105e21885
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 21601
13 clang                    0x0000000105e216a8
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 21124
14 clang                    0x0000000105e20ebb
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 19095
15 clang                    0x0000000105e2050c
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 16616
16 clang                    0x0000000105dca29f void
std::__1::__tree_right_rotate<std::__1::__tree_node_base<void*>*>(std::__1::__tree_node_base<void*>*)
+ 4907
17 clang                    0x0000000105d68ac7
llvm::SmallVectorTemplateBase<llvm::DenseMap<clang::BaseSubobject, unsigned
long long, llvm::DenseMapInfo<clang::BaseSubobject> >, false>::grow(unsigned
long) + 20391
18 clang                    0x0000000105b5a89b
std::__1::__tree<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>,
std::__1::__map_value_compare<clang::edit::FileOffset,
std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>, std::__1::less<clang::edit::FileOffset>,
true>, std::__1::allocator<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit> >
>::destroy(std::__1::__tree_node<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>, void*>*) + 4715
19 clang                    0x0000000105b38c4d
std::__1::__vector_base<clang::CompilerInstance*,
std::__1::allocator<clang::CompilerInstance*> >::~__vector_base() + 14127
20 clang                    0x0000000105b0c6bc
std::__1::enable_if<__is_forward_iterator<char const*>::value, void>::type
std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >::__init<char const*>(char const*, char const*) +
3322
21 clang                    0x0000000105b05aae
22 clang                    0x0000000105b0ad2d
std::__1::__split_buffer<llvm::SourceMgr::SrcBuffer,
std::__1::allocator<llvm::SourceMgr::SrcBuffer>&>::~__split_buffer() + 6401
23 libdyld.dylib            0x00007fff86f295fd start + 1
24 libdyld.dylib            0x000000000000002d start + 2030922289
Stack dump:
0.    Program arguments: /usr/local/Cellar/llvm35/3.5.0/lib/llvm-3.5/bin/clang
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-main-file-name hoge.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.4
-dwarf-column-info -resource-dir
/usr/local/Cellar/llvm35/3.5.0/lib/llvm-3.5/bin/../lib/clang/3.5.0
-stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/rhayasd
-ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o
/var/folders/9t/jwm1hlr905g_wlnzrmbnb3cr0000gn/T/hoge-74cc55.o -x c++ hoge.cpp 
1.    <eof> parser at end of file
2.    hoge.cpp:23:1: parsing struct/union/class body 'X'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg:
/var/folders/9t/jwm1hlr905g_wlnzrmbnb3cr0000gn/T/hoge-9f3931.cpp
clang: note: diagnostic msg:
/var/folders/9t/jwm1hlr905g_wlnzrmbnb3cr0000gn/T/hoge-9f3931.sh
clang: note: diagnostic msg: 

********************

-- 
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/20140909/5737c420/attachment.html>


More information about the llvm-bugs mailing list