public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header
@ 2013-05-01 18:06 jmetcalfe at acm dot org
  2013-05-01 18:08 ` [Bug c++/57138] " jmetcalfe at acm dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jmetcalfe at acm dot org @ 2013-05-01 18:06 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 57138
           Summary: ICE in instantiate_class_template with variadic
                    templates, using declarations, save-temps and
                    precompiled header
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jmetcalfe@acm.org


Created attachment 29990
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29990
Failing test case - test.cpp

Getting a segmentation fault in some variadic template code. The bug seems very
sensitive to small changes in input (e.g. removing a std::cout line causes the
compile to succeed, or give a compile error without ICE). Managed to reduce it
to a small test case, but removing further code (even unused code) causes the
issue to go away, as does removing the (empty) precompiled header, or the
-save-temps in the command line below.

Command lines:
g++ -Winvalid-pch -std=gnu++11 -I.. test.hpp -o test.hpp.gch
g++ -Winvalid-pch -std=gnu++11 -I.. -save-temps -c test.cpp

GCC Version:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-languages=c,c++ --disable-checking
--disable-multilib --disable-multiarch --disable-nls --enable-lto
--enable-libstdcxx-time
Thread model: posix
gcc version 4.8.0 (GCC)

Also tested with 4.7.2, which produces the same error for this test case,
though is also sensitive to input and sometimes succeeds where 4.8 fails, or
vice versa. 



Output from 4.8.0:
 g++ -Winvalid-pch -std=gnu++11 -I.. -save-temps -c test.cpp
test.cpp: In instantiation of 'struct specify_some<C>':
test.cpp:46:20:   required from here
test.cpp:29:55: internal compiler error: Segmentation fault
     using type = Type<specified_args..., more_args...>;
                                                       ^
0x86943f crash_signal
        ../../gcc/toplev.c:332
0x508fd8 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11227
0x50c992 tsubst_template_args
        ../../gcc/cp/pt.c:9607
0x5091b8 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11465
0x50952d tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11107
0x50eb00 lookup_template_class_1
        ../../gcc/cp/pt.c:7363
0x50eb00 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/cp/pt.c:7562
0x5090af tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11337
0x50816e tsubst_decl
        ../../gcc/cp/pt.c:10625
0x509694 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11081
0x507f73 tsubst_decl
        ../../gcc/cp/pt.c:10037
0x509694 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11081
0x516817 instantiate_class_template_1
        ../../gcc/cp/pt.c:8818
0x516817 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:9054
0x56241d complete_type(tree_node*)
        ../../gcc/cp/typeck.c:131
0x5624bd complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ../../gcc/cp/typeck.c:143
0x4ec949 xref_basetypes(tree_node*, tree_node*)
        ../../gcc/cp/decl.c:12105
0x543ef1 cp_parser_class_head
        ../../gcc/cp/parser.c:18895
0x543ef1 cp_parser_class_specifier_1
        ../../gcc/cp/parser.c:18194
0x543ef1 cp_parser_class_specifier
        ../../gcc/cp/parser.c:18463



And from 4.7:

test.cpp: In instantiation of 'struct specify_some<C>':
test.cpp:46:20:   required from here
test.cpp:44:33: internal compiler error: Segmentation fault



Please excuse the slightly horrific use of variadic templates...


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

* [Bug c++/57138] ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
@ 2013-05-01 18:08 ` jmetcalfe at acm dot org
  2013-05-02  7:02 ` [Bug c++/57138] ICE in cp_parser_class_specifier " jmetcalfe at acm dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jmetcalfe at acm dot org @ 2013-05-01 18:08 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Jacob Metcalfe <jmetcalfe at acm dot org> 2013-05-01 18:08:28 UTC ---
Note test.hpp is empty, as mentioned in the previous post. Can't upload it
because of this.


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

* [Bug c++/57138] ICE in cp_parser_class_specifier with variadic templates, using declarations, save-temps and precompiled header
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
  2013-05-01 18:08 ` [Bug c++/57138] " jmetcalfe at acm dot org
@ 2013-05-02  7:02 ` jmetcalfe at acm dot org
  2013-05-02  9:55 ` [Bug c++/57138] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jmetcalfe at acm dot org @ 2013-05-02  7:02 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jacob Metcalfe <jmetcalfe at acm dot org> 2013-05-02 07:02:47 UTC ---
Modified the subject to reflect the stack produced by the given example. In our
larger code base the stack was somewhat different but related. I have been
unable to produce this stack in a reduced example because of the sensitivity to
removing unused lines of code:

GCC 4.8.0 stack:
core/Policy.hpp:37:59: internal compiler error: Segmentation fault
         using type = Type<specified_args..., more_args...>;
                                                           ^
0x86943f crash_signal
        ../../gcc/toplev.c:332
0x508fd8 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11227
0x50c992 tsubst_template_args
        ../../gcc/cp/pt.c:9607
0x5091b8 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11465
0x50952d tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11107
0x50eb00 lookup_template_class_1
        ../../gcc/cp/pt.c:7363
0x50eb00 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/cp/pt.c:7562
0x5090af tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11337
0x50816e tsubst_decl
        ../../gcc/cp/pt.c:10625
0x509694 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11081
0x50be68 instantiate_template_1
        ../../gcc/cp/pt.c:14719
0x50be68 instantiate_template(tree_node*, tree_node*, int)
        ../../gcc/cp/pt.c:14769
0x5097a7 instantiate_alias_template
        ../../gcc/cp/pt.c:14799
0x5097a7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11108
0x50816e tsubst_decl
        ../../gcc/cp/pt.c:10625
0x509694 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11081
0x507f73 tsubst_decl
        ../../gcc/cp/pt.c:10037
0x509694 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11081
0x516817 instantiate_class_template_1
        ../../gcc/cp/pt.c:8818
0x516817 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:9054


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

* [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations, save-temps and precompiled header
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
  2013-05-01 18:08 ` [Bug c++/57138] " jmetcalfe at acm dot org
  2013-05-02  7:02 ` [Bug c++/57138] ICE in cp_parser_class_specifier " jmetcalfe at acm dot org
@ 2013-05-02  9:55 ` jakub at gcc dot gnu.org
  2013-05-10  2:37 ` [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-02  9:55 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-02
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
   Target Milestone|---                         |4.8.1
            Summary|ICE in                      |[4.8/4.9 Regression] ICE in
                   |cp_parser_class_specifier   |cp_parser_class_specifier
                   |with variadic templates,    |with variadic templates,
                   |using declarations,         |using declarations,
                   |save-temps and precompiled  |save-temps and precompiled
                   |header                      |header
     Ever Confirmed|0                           |1

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-02 09:55:45 UTC ---
No PCH is needed, just --enable-checking=yes compiler.
Simplified testcase for -std=c++0x:
template <template <typename ... X> class T, typename ... Y>
struct D
{
  template <typename ... Z>
  using type = T <Y..., Z...>;
};
template <typename T>
class A {};
template <typename X, typename Y>
struct B;
template <typename T>
struct B <int, T>
{
  typedef A <T> type;
};
template <typename X, typename Y>
using C = typename B <X, Y>::type;
struct E : public D <C> {};

The ICE started with http://gcc.gnu.org/r186434


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

* [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (2 preceding siblings ...)
  2013-05-02  9:55 ` [Bug c++/57138] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
@ 2013-05-10  2:37 ` jason at gcc dot gnu.org
  2013-05-31 10:58 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-10  2:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
This seems like another instance of bug 51239/DR 1430, which seems likely to be
resolved to make this code ill-formed.


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

* [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (3 preceding siblings ...)
  2013-05-10  2:37 ` [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations jason at gcc dot gnu.org
@ 2013-05-31 10:58 ` jakub at gcc dot gnu.org
  2013-08-03 20:33 ` [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-31 10:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.1                       |4.8.2

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.1 has been released.


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

* [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (4 preceding siblings ...)
  2013-05-31 10:58 ` jakub at gcc dot gnu.org
@ 2013-08-03 20:33 ` jason at gcc dot gnu.org
  2013-10-16  9:51 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2013-08-03 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
            Summary|[4.8/4.9 Regression] ICE in |[4.8 Regression][DR 1430]
                   |cp_parser_class_specifier   |ICE with pack expansion and
                   |with variadic templates,    |alias template
                   |using declarations          |

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
ICE fixed for 4.9 with r201469.


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

* [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (5 preceding siblings ...)
  2013-08-03 20:33 ` [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template jason at gcc dot gnu.org
@ 2013-10-16  9:51 ` jakub at gcc dot gnu.org
  2014-05-22  9:00 ` rguenth at gcc dot gnu.org
  2014-08-01 18:46 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-10-16  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.2                       |4.8.3

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.2 has been released.


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

* [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (6 preceding siblings ...)
  2013-10-16  9:51 ` jakub at gcc dot gnu.org
@ 2014-05-22  9:00 ` rguenth at gcc dot gnu.org
  2014-08-01 18:46 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-22  9:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57138

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.3                       |4.8.4

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.8.3 is being released, adjusting target milestone.


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

* [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template
  2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
                   ` (7 preceding siblings ...)
  2014-05-22  9:00 ` rguenth at gcc dot gnu.org
@ 2014-08-01 18:46 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-08-01 18:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57138

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Duplicate.

*** This bug has been marked as a duplicate of bug 51239 ***


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

end of thread, other threads:[~2014-08-01 18:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 18:06 [Bug c++/57138] New: ICE in instantiate_class_template with variadic templates, using declarations, save-temps and precompiled header jmetcalfe at acm dot org
2013-05-01 18:08 ` [Bug c++/57138] " jmetcalfe at acm dot org
2013-05-02  7:02 ` [Bug c++/57138] ICE in cp_parser_class_specifier " jmetcalfe at acm dot org
2013-05-02  9:55 ` [Bug c++/57138] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2013-05-10  2:37 ` [Bug c++/57138] [4.8/4.9 Regression] ICE in cp_parser_class_specifier with variadic templates, using declarations jason at gcc dot gnu.org
2013-05-31 10:58 ` jakub at gcc dot gnu.org
2013-08-03 20:33 ` [Bug c++/57138] [4.8 Regression][DR 1430] ICE with pack expansion and alias template jason at gcc dot gnu.org
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2014-05-22  9:00 ` rguenth at gcc dot gnu.org
2014-08-01 18:46 ` 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).