[LLVMbugs] [Bug 14171] New: Parser crash on constexpr (operator type)(

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 24 15:05:49 PDT 2012


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

             Bug #: 14171
           Summary: Parser crash on constexpr (operator type)(
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chortos at inbox.lv
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9413
  --> http://llvm.org/bugs/attachment.cgi?id=9413
minimal valid-C++ test case

struct { constexpr (operator int)(
is enough to make Clang crash. It continues to crash even if I complete the
declaration with ')', ');', ') {}', '); };' or ') {} };' and name the struct.
It stops crashing if I remove the parentheses around 'operator int'.

Attached is the named-struct '); };' version, because it is the minimal one
that is valid C++. The preprocessed source and run script are not included
because the preprocessor is not used, a simple 'clang -std=c++11
attachment.cpp' is enough to trigger the crash and the full run script is
reproduced in the stack trace anyway.

Here is the said stack trace:

Assertion failed: (Chunk.Kind == DeclaratorChunk::Function), function
VisitFunctionTypeLoc, file SemaType.cpp, line 3275.
0  clang             0x000000010101872a
llvm::SmallVectorTemplateBase<llvm_regmatch_t, false>::grow(unsigned long) +
356
1  clang             0x00000001010189db
llvm::SmallVectorTemplateBase<llvm_regmatch_t, false>::grow(unsigned long) +
1045
2  libSystem.B.dylib 0x00007fff82fe31ba _sigtramp + 26
3  libSystem.B.dylib 000000000000000000 _sigtramp + 2097270368
4  clang             0x000000010004b746 std::vector<char, std::allocator<char>
>::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, unsigned long, char const&) + 1698
5  clang             0x000000010004b7aa std::vector<char, std::allocator<char>
>::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char,
std::allocator<char> > >, unsigned long, char const&) + 1798
6  clang             0x0000000100531609
llvm::cast_retty<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>::ret_type
llvm::cast<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>(clang::sema::FunctionScopeInfo* const&) + 1333
7  clang             0x00000001005378bb
llvm::cast_retty<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>::ret_type
llvm::cast<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>(clang::sema::FunctionScopeInfo* const&) +
26599
8  clang             0x000000010053e579
llvm::cast_retty<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>::ret_type
llvm::cast<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>(clang::sema::FunctionScopeInfo* const&) +
54437
9  clang             0x000000010053e8d2
llvm::cast_retty<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>::ret_type
llvm::cast<clang::sema::LambdaScopeInfo,
clang::sema::FunctionScopeInfo*>(clang::sema::FunctionScopeInfo* const&) +
55294
10 clang             0x00000001003581c7
llvm::cast_retty<clang::BlockPointerTypeLoc, clang::TypeLoc*>::ret_type
llvm::dyn_cast<clang::BlockPointerTypeLoc, clang::TypeLoc*>(clang::TypeLoc*
const&) + 137015
11 clang             0x00000001003a2725 llvm::cast_retty<clang::BlockDecl,
clang::Decl const*>::ret_type llvm::dyn_cast<clang::BlockDecl, clang::Decl
const*>(clang::Decl const* const&) + 190537
12 clang             0x000000010028ac72 llvm::cast_retty<clang::NamedDecl,
clang::Decl*>::ret_type llvm::dyn_cast<clang::NamedDecl,
clang::Decl*>(clang::Decl* const&) + 20398
13 clang             0x000000010028bb56 llvm::cast_retty<clang::NamedDecl,
clang::Decl*>::ret_type llvm::dyn_cast<clang::NamedDecl,
clang::Decl*>(clang::Decl* const&) + 24210
14 clang             0x000000010028e06d llvm::cast_retty<clang::NamedDecl,
clang::Decl*>::ret_type llvm::dyn_cast<clang::NamedDecl,
clang::Decl*>(clang::Decl* const&) + 33705
15 clang             0x00000001002815db clang::CUDAGlobalAttr*
clang::getSpecificAttr<clang::CUDAGlobalAttr, llvm::SmallVector<clang::Attr*,
2u> >(llvm::SmallVector<clang::Attr*, 2u> const&) + 51734
16 clang             0x00000001002b69dc
llvm::cast_retty<clang::FunctionTemplateDecl, clang::Decl*>::ret_type
llvm::dyn_cast_or_null<clang::FunctionTemplateDecl, clang::Decl>(clang::Decl*)
+ 18084
17 clang             0x00000001002b6cc8
llvm::cast_retty<clang::FunctionTemplateDecl, clang::Decl*>::ret_type
llvm::dyn_cast_or_null<clang::FunctionTemplateDecl, clang::Decl>(clang::Decl*)
+ 18832
18 clang             0x00000001002b7d15
llvm::cast_retty<clang::FunctionTemplateDecl, clang::Decl*>::ret_type
llvm::dyn_cast_or_null<clang::FunctionTemplateDecl, clang::Decl>(clang::Decl*)
+ 23005
19 clang             0x00000001002b80e2
llvm::cast_retty<clang::FunctionTemplateDecl, clang::Decl*>::ret_type
llvm::dyn_cast_or_null<clang::FunctionTemplateDecl, clang::Decl>(clang::Decl*)
+ 23978
20 clang             0x0000000100274cfa clang::CUDAGlobalAttr*
clang::getSpecificAttr<clang::CUDAGlobalAttr, llvm::SmallVector<clang::Attr*,
2u> >(llvm::SmallVector<clang::Attr*, 2u> const&) + 309
21 clang             0x00000001002435b7 std::vector<clang::CXXRecordDecl
const*, std::allocator<clang::CXXRecordDecl const*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<clang::CXXRecordDecl const**,
std::vector<clang::CXXRecordDecl const*, std::allocator<clang::CXXRecordDecl
const*> > >, clang::CXXRecordDecl const* const&) + 4481
22 clang             0x000000010009d1d8
llvm::SmallVectorTemplateBase<clang::CharSourceRange, false>::grow(unsigned
long) + 3714
23 clang             0x0000000100080a30 std::vector<clang::CompilerInstance*,
std::allocator<clang::CompilerInstance*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<clang::CompilerInstance**,
std::vector<clang::CompilerInstance*, std::allocator<clang::CompilerInstance*>
> >, clang::CompilerInstance* const&) + 2382
24 clang             0x00000001000545eb std::basic_string<char,
std::char_traits<char>, std::allocator<char> > std::operator+<char,
std::char_traits<char>, std::allocator<char> >(char, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) + 3861
25 clang             0x000000010004e3e7 AnnotateIgnoreWritesEnd + 5073
26 clang             0x000000010005202e std::vector<std::string,
std::allocator<std::string> >::operator=(std::vector<std::string,
std::allocator<std::string> > const&) + 2852
27 clang             0x000000010004dd2c AnnotateIgnoreWritesEnd + 3350
28 clang             0x000000000000002e AnnotateIgnoreWritesEnd + 4294651928
Stack dump:
0.    Program arguments: /usr/local/Cellar/llvm/HEAD/bin/clang -cc1 -triple
x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free -main-file-name
y.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu
core2 -target-linker-version 97.17 -resource-dir
/usr/local/Cellar/llvm/HEAD/bin/../lib/clang/3.2 -fmodule-cache-path
/var/folders/Op/OpppQ-6+EVO2N3GIz+GoZU+++TI/-Tmp-/clang-module-cache -std=c++11
-fdeprecated-macro -fdebug-compilation-dir
/Users/astiob/Projects.localized/screenshot/c++/clang-crash-minimal
-ferror-limit 19 -fmessage-length 261 -stack-protector 1 -mstackrealign
-fblocks -fobjc-runtime=macosx-10.6.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/Op/OpppQ-6+EVO2N3GIz+GoZU+++TI/-Tmp-/y-oSiGDJ.o -x c++ y.cpp 
1.    y.cpp:3:28: current parser token ';'
2.    y.cpp:1:1: parsing struct/union/class body 'A'
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2  (http://llvm.org/git/llvm.git
64486737d59c835725c61c96511beeff7e31f403)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

-- 
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