[LLVMbugs] [Bug 14052] New: Several crashes on function template instantiations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 10 07:52:08 PDT 2012


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

             Bug #: 14052
           Summary: Several crashes on function template instantiations
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abramo.bagnara at bugseng.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The opaque types used in expr seems to badly confuse the instantiation.

$ cat p1.cc

template <typename T>
void f(__builtin_va_list args) {
  sizeof(struct S1*);
  (struct S2*)0;
  static_cast<struct S3*>(0);
  new struct S4*;
  __builtin_va_arg(args, struct S5 *);
}

void g() {
  f<int>(0);
}

$ clang++ -c p1.cc
p1.cc:4:3: warning: expression result unused [-Wunused-value]
  sizeof(struct S1*);
  ^~~~~~~~~~~~~~~~~~
clang: SemaTemplateInstantiate.cpp:2683: llvm::PointerUnion<clang::Decl*,
llvm::SmallVector<clang::Decl*, 4u>*>*
clang::LocalInstantiationScope::findInstantiationOf(const clang::Decl*):
Assertion `isa<LabelDecl>(D) && "declaration not instantiated in this scope"'
failed.
0  clang           0x0000000001cee44f
1  clang           0x0000000001cee949
2  libpthread.so.0 0x00007f26ebfb4cb0
3  libc.so.6       0x00007f26eb208445 gsignal + 53
4  libc.so.6       0x00007f26eb20bbab abort + 379
5  libc.so.6       0x00007f26eb20110e
6  libc.so.6       0x00007f26eb2011b2
7  clang           0x0000000000d1edee
clang::LocalInstantiationScope::findInstantiationOf(clang::Decl const*) + 334
8  clang           0x0000000000d4e588
clang::Sema::FindInstantiatedDecl(clang::SourceLocation, clang::NamedDecl*,
clang::MultiLevelTemplateArgumentList const&) + 472
9  clang           0x0000000000d1aea6
10 clang           0x0000000000d1b565
11 clang           0x0000000000d336e0
12 clang           0x0000000000d357c4
13 clang           0x0000000000d3359c
14 clang           0x0000000000d344a3
15 clang           0x0000000000d222e7
16 clang           0x0000000000d23582
17 clang           0x0000000000d3f4bb
18 clang           0x0000000000d2f865
19 clang           0x0000000000d3feb0
20 clang           0x0000000000d41bc1
21 clang           0x0000000000d40687
22 clang           0x0000000000d42e4f clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 79
23 clang           0x0000000000d56943
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 803
24 clang           0x0000000000d56301
clang::Sema::PerformPendingInstantiations(bool) + 657
25 clang           0x0000000000a7b952 clang::Sema::ActOnEndOfTranslationUnit()
+ 466
26 clang           0x00000000009f0666
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 374
27 clang           0x00000000009e808d clang::ParseAST(clang::Sema&, bool, bool)
+ 509
28 clang           0x0000000000739ae1 clang::FrontendAction::Execute() + 145
29 clang           0x000000000071ac04
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 340
30 clang           0x0000000000700f66
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1462
31 clang           0x00000000006f88c0 cc1_main(char const**, char const**, char
const*, void*) + 720
32 clang           0x00000000006e4fd3 main + 787
33 libc.so.6       0x00007f26eb1f376d __libc_start_main + 237
34 clang           0x00000000006f639d
Stack dump:
0.    Program arguments: /home/abramo/llvm_trunk/Release+Asserts/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name p1.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.22 -momit-leaf-frame-pointer -coverage-file
/home/abramo/p1.o -resource-dir
/home/abramo/llvm_trunk/Release+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem /usr/local/include -internal-isystem
/home/abramo/llvm_trunk/Release+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/abramo -ferror-limit 19
-fmessage-length 80 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o p1.o -x c++ p1.cc 
1.    <eof> parser at end of file
2.    p1.cc:3:6: instantiating function definition 'f'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 165617)
Target: x86_64-unknown-linux-gnu
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: /tmp/p1-t9mS5I.cpp
clang: note: diagnostic msg: /tmp/p1-t9mS5I.sh
clang: note: diagnostic msg: 

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

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