public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
@ 2022-06-14 21:11 redi at gcc dot gnu.org
  2022-06-14 21:14 ` [Bug c++/105982] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-14 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105982
           Summary: [13 Regression] internal compiler error: in
                    lookup_template_class, at cp/pt.cc:10361
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

I think this is a new-ish regression. It happens when running the libstdc++
testsuite with -std=c++20 i.e. in the $target/libstdc++-v3 build dir:

make check RUNTESTFLAGS="conformance.exp=21_strings/*/deduction.cc
--target_board=unix/-std=gnu++20"

In file included from
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/string:52,
                 from
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc:20:
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:
In substitution of 'template<class _CharT, class _Traits, class _Alloc, class>
basic_string(typename std::__cxx11::basic_string<_CharT, _Traits,
_Alloc>::_Alloc_traits_impl<_Traits, void>::size_type, _CharT, const _Alloc&)->
std::__cxx11::basic_string<_CharT, _Traits, _Alloc> [with _CharT =
std::allocator<char>; _Traits = std::char_traits<std::allocator<char> >; _Alloc
= std::allocator<std::allocator<char> >; <template-parameter-1-4> =
std::allocator<std::allocator<char> >]':
/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/deduction.cc:53:
  required from here
/home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:656:
internal compiler error: in lookup_template_class, at cp/pt.cc:10361
0x71a527 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:10361
0xb638d1 tsubst_aggr_type
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:13802
0xb638d1 tsubst_aggr_type
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:13753
0xb57c74 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:16282
0xb643d4 tsubst_arg_types
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:15251
0xb64759 tsubst_arg_types
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:15228
0xb64759 tsubst_function_type
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:15406
0xb5766e tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:16200
0xb3ebe6 tsubst_function_decl
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:14179
0xb4198a tsubst_decl
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:14656
0xb56bf6 instantiate_template(tree_node*, tree_node*, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:21776
0xb6c88a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:22289
0x960b81 add_template_candidate_real
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:3555
0x961bc3 add_template_candidate
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:3643
0x961bc3 add_candidates
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:6191
0x967d37 add_candidates
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:4717
0x967d37 perform_overload_resolution
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:4725
0x968179 perform_dguide_overload_resolution(tree_node*, vec<tree_node*, va_gc,
vl_embed> const*, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/call.cc:4789
0xb32b93 do_class_deduction
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:30214
0xb32b93 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        /home/jwakely/src/gcc/gcc/gcc/cp/pt.cc:30302
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
@ 2022-06-14 21:14 ` redi at gcc dot gnu.org
  2022-06-14 21:16 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-14 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 53138
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53138&action=edit
-freport-bug output

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
  2022-06-14 21:14 ` [Bug c++/105982] " redi at gcc dot gnu.org
@ 2022-06-14 21:16 ` redi at gcc dot gnu.org
  2022-06-15  9:14 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-14 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-06-14
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ppalka at gcc dot gnu.org
      Known to fail|                            |13.0
   Target Milestone|---                         |13.0
      Known to work|                            |12.1.0
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Regression started with r13-1045

c++: optimize specialization of nested templated classes

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
  2022-06-14 21:14 ` [Bug c++/105982] " redi at gcc dot gnu.org
  2022-06-14 21:16 ` redi at gcc dot gnu.org
@ 2022-06-15  9:14 ` rguenth at gcc dot gnu.org
  2022-06-19 18:43 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-15  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-06-15  9:14 ` rguenth at gcc dot gnu.org
@ 2022-06-19 18:43 ` ppalka at gcc dot gnu.org
  2022-06-23 20:20 ` cvs-commit at gcc dot gnu.org
  2022-06-23 20:22 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-06-19 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-06-19 18:43 ` ppalka at gcc dot gnu.org
@ 2022-06-23 20:20 ` cvs-commit at gcc dot gnu.org
  2022-06-23 20:22 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-23 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:01aff2ba18a654324957af446a3065db489c0f14

commit r13-1224-g01aff2ba18a654324957af446a3065db489c0f14
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jun 23 16:18:55 2022 -0400

    c++: context completion in lookup_template_class [PR105982]

    The below testcase demonstrates that completion of the substituted
    context during lookup_template_class can end up registering the desired
    specialization for us in more cases than r13-1045-gcb7fd1ea85feea
    anticipated.  In particular this can happen for a non-dependent
    specialization of a nested class as well.

    For this testcase, during overload resolution with A's guides, we
    substitute the deduced argument T=int into the TYPENAME_TYPE B::C,
    during which we call lookup_template_class for A<T>::B with T=int,
    which completes A<int> for the first time, which recursively registers
    the desired specialization of B already.  The parent call to
    lookup_template_class then tries to register the same specialization,
    triggering an ICE.

    This patch fixes this by making lookup_template_class determine more
    directly whether we need to recheck the specializations table after
    completion of the context -- when and only when the call to complete_type
    had an effect.

            PR c++/105982

    gcc/cp/ChangeLog:

            * pt.cc (lookup_template_class): After calling complete_type for
            the substituted context, check the table again iff the type was
            previously incomplete and complete_type made it complete.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction111.C: New test.

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

* [Bug c++/105982] [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361
  2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-06-23 20:20 ` cvs-commit at gcc dot gnu.org
@ 2022-06-23 20:22 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-06-23 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-06-23 20:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 21:11 [Bug c++/105982] New: [13 Regression] internal compiler error: in lookup_template_class, at cp/pt.cc:10361 redi at gcc dot gnu.org
2022-06-14 21:14 ` [Bug c++/105982] " redi at gcc dot gnu.org
2022-06-14 21:16 ` redi at gcc dot gnu.org
2022-06-15  9:14 ` rguenth at gcc dot gnu.org
2022-06-19 18:43 ` ppalka at gcc dot gnu.org
2022-06-23 20:20 ` cvs-commit at gcc dot gnu.org
2022-06-23 20:22 ` ppalka 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).