[LLVMbugs] [Bug 16303] New: mismatched argument pack lengths -> segfault or no error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 11 17:20:00 PDT 2013


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

            Bug ID: 16303
           Summary: mismatched argument pack lengths -> segfault or no
                    error
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: temporal at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10664
  --> http://llvm.org/bugs/attachment.cgi?id=10664&action=edit
code that sefaults clang

I was learning how non-recursive tuples are implemented, and ran into a
problem:  Clang didn't complain if I passed too many arguments to my tuple
constructor, and segfaulted if I passed too few.  It appears that in a place
where I am unpacking multiple variadic template argument packs, Clang is not
checking that the two packs have the same length.  GCC reports the appropriate
error in both cases.

Sample code attached.  Compile with:
  clang++ -std=c++11 -c test.c++

Error dump:

0  libLLVM-3.2.so.1 0x00007fcde4fb567f
1  libLLVM-3.2.so.1 0x00007fcde4fb5ae9
2  libpthread.so.0  0x00007fcde4068bd0
3  clang            0x0000000000e7fb68
clang::ASTContext::getSubstTemplateTypeParmType(clang::TemplateTypeParmType
const*, clang::QualType) const + 296
4  clang            0x0000000000b1e5d9
5  clang            0x0000000000b2cf60
6  clang            0x0000000000b2e618
7  clang            0x0000000000b27325
8  clang            0x0000000000b28b68
9  clang            0x0000000000b348c4
10 clang            0x0000000000b264fa
11 clang            0x0000000000b3b72b
12 clang            0x0000000000b26020
13 clang            0x0000000000b36a63
14 clang            0x0000000000b26493
15 clang            0x0000000000b3ea5f clang::Sema::SubstExpr(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&) + 79
16 clang            0x0000000000b41a0d
clang::Sema::SubstInitializer(clang::Expr*,
clang::MultiLevelTemplateArgumentList const&, bool) + 77
17 clang            0x0000000000b47441
clang::Sema::InstantiateMemInitializers(clang::CXXConstructorDecl*,
clang::CXXConstructorDecl const*, clang::MultiLevelTemplateArgumentList const&)
+ 1009
18 clang            0x0000000000b4dd8d
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2189
19 clang            0x0000000000b4cd2e
clang::Sema::PerformPendingInstantiations(bool) + 494
20 clang            0x0000000000b4dcea
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2026
21 clang            0x0000000000b4cd2e
clang::Sema::PerformPendingInstantiations(bool) + 494
22 clang            0x00000000008e1903 clang::Sema::ActOnEndOfTranslationUnit()
+ 2323
23 clang            0x0000000000861613
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 387
24 clang            0x0000000000859afb clang::ParseAST(clang::Sema&, bool,
bool) + 267
25 clang            0x00000000005f50b1 clang::FrontendAction::Execute() + 97
26 clang            0x00000000005dc57a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 282
27 clang            0x00000000005c5e92
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1378
28 clang            0x00000000005c0e88 cc1_main(char const**, char const**,
char const*, void*) + 1160
29 clang            0x00000000005bfd84 main + 7316
30 libc.so.6        0x00007fcde3799ea5 __libc_start_main + 245
31 clang            0x00000000005c0889
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
test.c++ -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.23.2 -momit-leaf-frame-pointer -coverage-file
/home/kenton/test/test.o -resource-dir /usr/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.2/include -internal-isystem
/usr/include/clang/3.2/include/ -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -std=c++11
-fdeprecated-macro -fdebug-compilation-dir /home/kenton/test -ferror-limit 19
-fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o test.o -x c++ test.c++ 
1.    <eof> parser at end of file
2.    test.c++:37:3: instantiating function definition 'Tuple'
3.    test.c++:28:10: instantiating function definition 'TupleImpl'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM
3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix

-- 
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/20130612/8157404a/attachment.html>


More information about the llvm-bugs mailing list