public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50303] New: Segfault with variadic template template parameters.
@ 2011-09-06 14:45 andyspiros at gmail dot com
  2011-09-14 21:04 ` [Bug c++/50303] [C++0x] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: andyspiros at gmail dot com @ 2011-09-06 14:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

             Bug #: 50303
           Summary: Segfault with variadic template template parameters.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: andyspiros@gmail.com


Created attachment 25203
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25203
Preprocessed source

A function "f" taking a class and a set (variadic) of template classes as
template parameters is written. If this function passes the variadic parameter
to another one, the compiler fails with a segfault. Otherwise the compiler just
works.

This happens on Gentoo with gcc 4.6.1, on Fedora 15 with gcc-4.6.0, on the
online service ideone (see http://ideone.com/yrIfa -- there is the original
source too).

On Gentoo I have the following output:

$ g++ -v -save-temps -std=c++0x variadic_template.cpp -pedantic-errors

Using built-in specs.
Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/asneeded.specs
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.1/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.6.1-r1/work/gcc-4.6.1/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --disable-werror
--enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.1/python
--enable-checking=release --enable-languages=c,c++,java,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.1-r1 p1.0,
pie-0.4.5'
Thread model: posix
gcc version 4.6.1 (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-pedantic-errors'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.1/cc1plus -E -quiet -v -D_GNU_SOURCE
variadic_template.cpp -D_FORTIFY_SOURCE=2 -mtune=generic -march=x86-64
-std=c++0x -pedantic-errors -fpch-preprocess -o variadic_template.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include/g++-v4/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-pedantic-errors'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.1/cc1plus -fpreprocessed
variadic_template.ii -quiet -dumpbase variadic_template.cpp -mtune=generic
-march=x86-64 -auxbase variadic_template -pedantic-errors -std=c++0x -version
-o variadic_template.s
GNU C++ (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) version 4.6.1 (x86_64-pc-linux-gnu)
    compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1-p4,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Gentoo 4.6.1-r1 p1.0, pie-0.4.5) version 4.6.1 (x86_64-pc-linux-gnu)
    compiled by GNU C version 4.6.1, GMP version 5.0.2, MPFR version 3.0.1-p4,
MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 510fa67dba4694d68782d987f500559c
variadic_template.cpp: In function ‘void f() [with Interface = I1, Actions =
A1, A2]’:
variadic_template.cpp:58:16:   instantiated from here
variadic_template.cpp:49:58: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.gentoo.org/> for instructions.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
@ 2011-09-14 21:04 ` paolo.carlini at oracle dot com
  2011-09-14 22:48 ` andyspiros at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-14 21:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-14 20:59:20 UTC ---
Can you try reducing your testcase? 563 KB is definitely unmanageable.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
  2011-09-14 21:04 ` [Bug c++/50303] [C++0x] " paolo.carlini at oracle dot com
@ 2011-09-14 22:48 ` andyspiros at gmail dot com
  2011-09-14 23:11 ` andyspiros at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: andyspiros at gmail dot com @ 2011-09-14 22:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

Andrea Arteaga <andyspiros at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #25203|0                           |1
        is obsolete|                            |

--- Comment #2 from Andrea Arteaga <andyspiros at gmail dot com> 2011-09-14 22:46:19 UTC ---
Created attachment 25275
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25275
Not-preprocessed source

As requested, I attach a minimal source code with some comments. There are no
external dependencies, just <iostream> gets #included. The compilation result
is the same as already stated (segmentation fault during compilation).


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
  2011-09-14 21:04 ` [Bug c++/50303] [C++0x] " paolo.carlini at oracle dot com
  2011-09-14 22:48 ` andyspiros at gmail dot com
@ 2011-09-14 23:11 ` andyspiros at gmail dot com
  2011-09-15  0:32 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: andyspiros at gmail dot com @ 2011-09-14 23:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

--- Comment #3 from Andrea Arteaga <andyspiros at gmail dot com> 2011-09-14 22:47:56 UTC ---
I recently blogged about this issue: http://wp.me/pzWEm-9N.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (2 preceding siblings ...)
  2011-09-14 23:11 ` andyspiros at gmail dot com
@ 2011-09-15  0:32 ` paolo.carlini at oracle dot com
  2011-09-15  7:49 ` markus at trippelsdorf dot de
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-15  0:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-14
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-14 23:11:11 UTC ---
Ah, ok, the below seems enough:

template<typename Interface>
struct A1 {
};

template<template<class I> class... Actions>
void g2() {
  g2<Actions...>();
}

int main()
{
  g2<A1>();
}


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (3 preceding siblings ...)
  2011-09-15  0:32 ` paolo.carlini at oracle dot com
@ 2011-09-15  7:49 ` markus at trippelsdorf dot de
  2012-04-16 15:33 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: markus at trippelsdorf dot de @ 2011-09-15  7:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #5 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2011-09-15 07:06:19 UTC ---
Program received signal SIGSEGV, Segmentation fault.
[Switching to process 30771]
tsubst_template_parms (parms=0x0, args=0x7ffff77a6d98, complain=3) at
../../gcc/gcc/cp/pt.c:9507
9507           TMPL_PARMS_DEPTH (parms) > TMPL_ARGS_DEPTH (args);

(gdb) bt
#0  tsubst_template_parms (parms=0x0, args=0x7ffff77a6d98, complain=3) at
../../gcc/gcc/cp/pt.c:9507
#1  0x00000000004c6d9a in tsubst_decl (t=0x7ffff77a7e60, args=0x7ffff77a6d98,
complain=3) at ../../gcc/gcc/cp/pt.c:9789
#2  0x00000000004c3ce5 in tsubst (in_decl=<optimized out>, complain=3,
args=0x7ffff77a6d98, t=0x7ffff77a7e60) at ../../gcc/gcc/cp/pt.c:10851
#3  tsubst (t=0x7ffff77a7e60, args=0x7ffff77a6d98, complain=3,
in_decl=<optimized out>) at ../../gcc/gcc/cp/pt.c:10836
#4  0x00000000004c821f in tsubst_pack_expansion (t=0x7ffff77afe70,
args=0x7ffff77a6f78, complain=3, in_decl=0x7ffff77a7f18)
    at ../../gcc/gcc/cp/pt.c:9298
#5  0x00000000004c656b in tsubst_template_args (t=0x7ffff77a6ac8,
args=0x7ffff77a6d98, complain=3, in_decl=0x7ffff77a7f18)
    at ../../gcc/gcc/cp/pt.c:9400
#6  0x00000000004c1e46 in tsubst_copy_and_build (t=0x7ffff7fd9a50,
args=0x7ffff77a6d98, complain=3, in_decl=0x7ffff77a7f18, function_p=1 '\001', 
    integral_constant_expression_p=<optimized out>) at
../../gcc/gcc/cp/pt.c:13035
#7  0x00000000004c1c9e in tsubst_copy_and_build (t=0x7ffff77bd038,
args=0x7ffff77a6d98, complain=3, in_decl=0x7ffff77a7f18, function_p=0 '\000', 
    integral_constant_expression_p=0 '\000') at ../../gcc/gcc/cp/pt.c:13390
#8  0x00000000004bd239 in tsubst_expr (t=0x7ffff77bd038, args=0x7ffff77a6d98,
complain=3, in_decl=0x7ffff77a7f18, 
    integral_constant_expression_p=0 '\000') at ../../gcc/gcc/cp/pt.c:12935
#9  0x00000000004bdc70 in tsubst_expr (t=0x7ffff77a6b40, args=0x7ffff77a6d98,
complain=3, in_decl=0x7ffff77a7f18, 
    integral_constant_expression_p=0 '\000') at ../../gcc/gcc/cp/pt.c:12467
#10 0x00000000004bd2b1 in tsubst_expr (t=0x7ffff77bd000, args=0x7ffff77a6d98,
complain=3, in_decl=0x7ffff77a7f18, 
    integral_constant_expression_p=0 '\000') at ../../gcc/gcc/cp/pt.c:12632
#11 0x00000000004d0ccc in instantiate_decl (d=0x7ffff77aee00,
defer_ok=<optimized out>, expl_inst_class_mem_p=<optimized out>)
    at ../../gcc/gcc/cp/pt.c:18305
#12 0x00000000004d34dc in instantiate_pending_templates (retries=<optimized
out>) at ../../gcc/gcc/cp/pt.c:18402
#13 0x00000000004e8a4d in cp_write_global_declarations () at
../../gcc/gcc/cp/decl2.c:3713
#14 0x00000000007f11c2 in compile_file () at ../../gcc/gcc/toplev.c:564
#15 do_compile () at ../../gcc/gcc/toplev.c:1886
#16 toplev_main (argc=13, argv=0x7fffffffdf28) at ../../gcc/gcc/toplev.c:1962
#17 0x00007ffff7b81f82 in __libc_start_main (main=0x5a11b0 <main>, argc=13,
ubp_av=0x7fffffffdf28, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdf18) at libc-start.c:226
#18 0x000000000048cf89 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (4 preceding siblings ...)
  2011-09-15  7:49 ` markus at trippelsdorf dot de
@ 2012-04-16 15:33 ` jason at gcc dot gnu.org
  2012-04-17  2:42 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-16 15:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (5 preceding siblings ...)
  2012-04-16 15:33 ` jason at gcc dot gnu.org
@ 2012-04-17  2:42 ` jason at gcc dot gnu.org
  2012-04-17 14:19 ` jason at gcc dot gnu.org
  2012-04-17 15:39 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17  2:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 02:29:32 UTC ---
Author: jason
Date: Tue Apr 17 02:29:27 2012
New Revision: 186519

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186519
Log:
    PR c++/50303
    * pt.c (tsubst_pack_expansion): Use tsubst_expr for template
    template parameters.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic128.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (6 preceding siblings ...)
  2012-04-17  2:42 ` jason at gcc dot gnu.org
@ 2012-04-17 14:19 ` jason at gcc dot gnu.org
  2012-04-17 15:39 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17 14:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 14:11:04 UTC ---
Author: jason
Date: Tue Apr 17 14:10:54 2012
New Revision: 186531

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186531
Log:
    PR c++/50303
    * pt.c (tsubst_pack_expansion): Use tsubst_expr for template
    template parameters.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/variadic128.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/pt.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/50303] [C++0x] Segfault with variadic template template parameters
  2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
                   ` (7 preceding siblings ...)
  2012-04-17 14:19 ` jason at gcc dot gnu.org
@ 2012-04-17 15:39 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17 15:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50303

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.1

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 15:28:08 UTC ---
Fixed for 4.7.1.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-04-17 15:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-06 14:45 [Bug c++/50303] New: Segfault with variadic template template parameters andyspiros at gmail dot com
2011-09-14 21:04 ` [Bug c++/50303] [C++0x] " paolo.carlini at oracle dot com
2011-09-14 22:48 ` andyspiros at gmail dot com
2011-09-14 23:11 ` andyspiros at gmail dot com
2011-09-15  0:32 ` paolo.carlini at oracle dot com
2011-09-15  7:49 ` markus at trippelsdorf dot de
2012-04-16 15:33 ` jason at gcc dot gnu.org
2012-04-17  2:42 ` jason at gcc dot gnu.org
2012-04-17 14:19 ` jason at gcc dot gnu.org
2012-04-17 15:39 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).