[LLVMbugs] [Bug 11934] New: Crash on invalid when number of expected types doesn't match number of actual types in template specializations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 6 08:28:46 PST 2012


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

             Bug #: 11934
           Summary: Crash on invalid when number of expected types doesn't
                    match number of actual types in template
                    specializations
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8006
  --> http://llvm.org/bugs/attachment.cgi?id=8006
repro

I ran into this while trying to reduce the input for issue 11931.



tests-MacBook-Pro-2:src test$ ~/src/llvm-rw/Release+Asserts/bin/clang -c
foo-crash.cc 
foo-crash.cc:11:12: error: too many template arguments for class template
'BindState'
  Callback(BindState<Runnable, RunType, BoundArgsType>* bind_state) {
           ^                            ~~~~~~~~~~~~~~
foo-crash.cc:4:8: note: template is declared here
struct BindState;
       ^
foo-crash.cc:12:12: error: too many template arguments for class template
'BindState'
    (void)&BindState<Runnable, RunType, BoundArgsType>::InvokerType::Run;
           ^                            ~~~~~~~~~~~~~~
foo-crash.cc:4:8: note: template is declared here
struct BindState;
       ^
Assertion failed: (!SpecializedTemplate.is<SpecializedPartialSpecialization*>()
&& "Already set to a class template partial specialization!"), function
setInstantiationOf, file
/Users/test/src/llvm-rw/tools/clang/lib/Sema/../../include/clang/AST/DeclTemplate.h,
line 1389.
0  clang             0x0000000106a26872 _ZL15PrintStackTracePv + 34
1  clang             0x0000000106a26d89 _ZL13SignalHandleri + 697
2  libsystem_c.dylib 0x00007fff85516cfa _sigtramp + 26
3  libsystem_c.dylib 0x0000080010400000 _sigtramp + 18446612134645109536
4  clang             0x0000000106a26ab6 abort + 22
5  clang             0x0000000106a26a75 __assert_rtn + 53
6  clang             0x0000000105ab337f
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) + 2143
7  clang             0x0000000105af3bff
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
clang::PartialDiagnostic const&, std::pair<clang::SourceLocation,
clang::PartialDiagnostic>) + 783
8  clang             0x0000000105aec054
clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType,
unsigned int) + 116
9  clang             0x0000000105905b4d
clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Decl*) + 349
10 clang             0x0000000105ad256d
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 1501
11 clang             0x0000000105ad3b43
clang::Sema::PerformPendingInstantiations(bool) + 483
12 clang             0x000000010587643a
clang::Sema::ActOnEndOfTranslationUnit() + 410
13 clang             0x0000000105856080
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 112
14 clang             0x000000010580358b clang::ParseAST(clang::Sema&, bool) +
299
15 clang             0x00000001057cfcb6 clang::CodeGenAction::ExecuteAction() +
1142
16 clang             0x00000001055bc485
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 949
17 clang             0x00000001055a3af2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3026
18 clang             0x000000010559a70b cc1_main(char const**, char const**,
char const*, void*) + 3019
19 clang             0x000000010559fe8f main + 687
20 clang             0x0000000105599b34 start + 52
Stack dump:
0.    Program arguments: /Users/test/src/llvm-rw/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-main-file-name foo-crash.cc -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 127.2 -coverage-file
foo-crash.o -resource-dir
/Users/test/src/llvm-rw/Release+Asserts/bin/../lib/clang/3.1
-fmodule-cache-path
/var/folders/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/clang-module-cache
-fdeprecated-macro -fdebug-compilation-dir /Users/test/src/chrome-git/src
-ferror-limit 19 -fmessage-length 234 -stack-protector 1 -mstackrealign
-fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-dispatch-method=mixed -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o foo-crash.o -x c++
foo-crash.cc 
1.    <eof> parser at end of file
2.    foo-crash.cc:47:1: instantiating function definition 'Bind'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/foo-crash-iXCUlF.ii
clang: note: diagnostic msg:
/var/folders/5j/6xp_dl050mv_b_0_56s5mjx80000gn/T/foo-crash-iXCUlF.sh

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