[Bug c++/71451] New: ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] New: ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

            Bug ID: 71451
           Summary: ICE on invalid C++11 code on x86_64-linux-gnu: in
                    dependent_type_p, at cp/pt.c:22599
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu in both 32-bit and 64-bit modes.

This is a regression from 4.7.x (as it seems to affect 4.8.x and later).


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160607 (experimental) [trunk revision 237165] (GCC)
$
$ g++-trunk -std=c++11 small.cpp
small.cpp:6:39: error: parameter packs not expanded with ‘...’:
   template < typename A < T::value >::type > void foo ();
                                       ^~~~
small.cpp:6:39: note:         ‘T’
small.cpp: In substitution of ‘template<typename A<T:: value>::type
...<anonymous> > void B<T>::foo() [with typename A<T:: value>::type
...<anonymous> = {}]’:
small.cpp:12:10:   required from here
small.cpp:6:51: internal compiler error: in dependent_type_p, at cp/pt.c:22599
   template < typename A < T::value >::type > void foo ();
                                                   ^~~
0x6c1b53 dependent_type_p(tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:22599
0x6c2380 dependent_scope_p(tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:22630
0x6de2e4 tsubst_qualified_id
        ../../gcc-source-trunk/gcc/cp/pt.c:13753
0x6df3d4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:16224
0x6d401f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15820
0x6ea07c tsubst_template_arg
        ../../gcc-source-trunk/gcc/cp/pt.c:10391
0x6f9482 tsubst_template_args
        ../../gcc-source-trunk/gcc/cp/pt.c:11234
0x6fe28b tsubst_aggr_type
        ../../gcc-source-trunk/gcc/cp/pt.c:11431
0x6e7121 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:13432
0x6f95de tsubst_template_args
        ../../gcc-source-trunk/gcc/cp/pt.c:11226
0x6f96fa tsubst_template_args
        ../../gcc-source-trunk/gcc/cp/pt.c:11194
0x6eff05 tsubst_decl
        ../../gcc-source-trunk/gcc/cp/pt.c:11726
0x6e799e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:12829
0x6ffbcd instantiate_template_1
        ../../gcc-source-trunk/gcc/cp/pt.c:17421
0x6ffbcd instantiate_template(tree_node*, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/pt.c:17472
0x71161c fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:17847
0x67243b add_template_candidate_real
        ../../gcc-source-trunk/gcc/cp/call.c:3110
0x67316c add_template_candidate
        ../../gcc-source-trunk/gcc/cp/call.c:3188
0x67316c add_candidates
        ../../gcc-source-trunk/gcc/cp/call.c:5361
0x673a06 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8313
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$


-----------------------------------------------------------


template < int > struct A;

template < typename ... T >
struct B
{
  template < typename A < T::value >::type > void foo ();
};

int main ()
{
  B < int > t;
  t.foo ();
  return 0;
}
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [4.9/5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
           Priority|P3                          |P5
   Target Milestone|---                         |4.9.4
            Summary|ICE on invalid C++11 code   |[4.9/5/6/7 Regression] ICE
                   |on x86_64-linux-gnu: in     |on invalid C++11 code on
                   |dependent_type_p, at        |x86_64-linux-gnu: in
                   |cp/pt.c:22599               |dependent_type_p, at
                   |                            |cp/pt.c:22599
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [4.9/5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-06-08
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [4.9/5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.9.4                       |5.5

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 4.9 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2016-06-08 00:00:00         |2016-8-4
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |4.3.0, 4.5.3, 4.8.3, 4.9.3,
                   |                            |5.3.0, 6.1.0, 7.0

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The first revision that I have access to that shows the ICE is r125126 but I
suspect the root cause is actually r125062.  Prior to that, GCC rejected the
code with the error below:

t.C:8: error: parameter packs not expanded with `...':
t.C:8: note:         ‘T’
t.C: In function ‘int main()’:
t.C:14: error: no matching function for call to ‘B<int>::foo()’
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [5/6/7/8 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This seems already fixed in trunk. I guess we can as well add the testcase
there and of course keep the bug open.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [5/6/7/8 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu May 25 22:28:54 2017
New Revision: 248473

URL: https://gcc.gnu.org/viewcvs?rev=248473&root=gcc&view=rev
Log:
2017-05-25  Paolo Carlini  <[hidden email]>

        PR c++/71451
        * g++.dg/cpp0x/variadic170.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic170.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[5/6/7/8 Regression] ICE on |[5/6/7 Regression] ICE on
                   |invalid C++11 code on       |invalid C++11 code on
                   |x86_64-linux-gnu: in        |x86_64-linux-gnu: in
                   |dependent_type_p, at        |dependent_type_p, at
                   |cp/pt.c:22599               |cp/pt.c:22599

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |6.5
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.5                         |7.4

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 6 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.4                         |7.5
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71451] [7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in dependent_type_p, at cp/pt.c:22599

thiago at kde dot org
In reply to this post by thiago at kde dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71451

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |8.0
         Resolution|---                         |FIXED
   Target Milestone|7.5                         |8.0
      Known to fail|                            |7.5.0

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC8.