public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897
@ 2022-05-28 11:46 jakub at gcc dot gnu.org
  2022-05-28 11:47 ` [Bug c++/105758] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-28 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105758
           Summary: [12/13 Regression] ICE in build_baselink since
                    r12-6897
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Starting with r12-6897-gdec8d0e5fa00ceb2ded78b8a3eba8976d860a90e we ICE with
-std=c++11 on the following testcase:
struct A {
  template <typename D, typename T> void foo(D, T, int);
};
template <class, typename, class, class, class, class, class, class, class,
class, class, class>
struct Z : A {
  static Z *z;
  void bar();
};
template <class T, typename B, class P1, class P2, class P3, class P4, class
P5, class P6, class P7, class P8, class P9, class P10>
Z<T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> *Z<T, B, P1, P2, P3, P4, P5,
P6, P7, P8, P9, P10>::z;
template <class T, typename B, class P1, class P2, class P3, class P4, class
P5, class P6, class P7, class P8, class P9, class P10>
void Z<T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>::bar() {
  int a = 0, b = 1, c = 2;
  z->foo(a, b, c);
}

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

* [Bug c++/105758] [12/13 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
@ 2022-05-28 11:47 ` jakub at gcc dot gnu.org
  2022-05-31 13:24 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-28 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.2
                 CC|                            |ppalka at gcc dot gnu.org
           Priority|P3                          |P2

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

* [Bug c++/105758] [12/13 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
  2022-05-28 11:47 ` [Bug c++/105758] " jakub at gcc dot gnu.org
@ 2022-05-31 13:24 ` mpolacek at gcc dot gnu.org
  2022-05-31 14:45 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-05-31 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-31
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/105758] [12/13 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
  2022-05-28 11:47 ` [Bug c++/105758] " jakub at gcc dot gnu.org
  2022-05-31 13:24 ` mpolacek at gcc dot gnu.org
@ 2022-05-31 14:45 ` ppalka at gcc dot gnu.org
  2022-05-31 20:50 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-05-31 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

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++/105758] [12/13 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-05-31 14:45 ` ppalka at gcc dot gnu.org
@ 2022-05-31 20:50 ` cvs-commit at gcc dot gnu.org
  2022-07-21 16:47 ` [Bug c++/105758] [12 " cvs-commit at gcc dot gnu.org
  2022-07-21 16:48 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-31 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:4f84f12066953186cce4328b7f178d3daa2fe96e

commit r13-871-g4f84f12066953186cce4328b7f178d3daa2fe96e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 31 16:49:08 2022 -0400

    c++: non-dep call with empty TYPE_BINFO [PR105758]

    Here the out-of-line definition of Z<T>::z causes duplicate_decls to
    change z's type from using the primary template type Z<T> (which is also
    the type of the injected class name) to the implicit instantiation Z<T>,
    and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was
    set by a special case in lookup_template_class to point to the former).

    Later, when processing the non-dependent call z->foo(0), build_over_call
    relies on the object argument's TYPE_BINFO to build the templated form
    for this call, which fails because the object argument type has empty
    TYPE_BINFO due to the above.

    It seems weird that the implicit instantiation Z<T> doesn't have the
    same TYPE_BINFO as the primary template type Z<T>, despite them being
    proclaimed equivalent via TYPE_CANONICAL.  So I tried also setting
    TYPE_BINFO in the special case in lookup_template_class, but that led to
    some problems with constrained partial specializations of the form Z<T>.
    I'm not sure what, if anything, we ought to do about the subtle
    differences between these two versions of the same type.

    Fortunately it seems we don't need to rely on TYPE_BINFO at all in
    build_over_call here -- the z_candidate struct already contains the
    exact binfos we need to rebuild the BASELINK for the templated form.

            PR c++/105758

    gcc/cp/ChangeLog:

            * call.cc (build_over_call): Use z_candidate::conversion_path
            and ::access_path instead of TYPE_BINFO when building the
            BASELINK for the templated form.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/non-dependent24.C: New test.

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

* [Bug c++/105758] [12 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-05-31 20:50 ` cvs-commit at gcc dot gnu.org
@ 2022-07-21 16:47 ` cvs-commit at gcc dot gnu.org
  2022-07-21 16:48 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-21 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:4ebc9fef1ac36f353866c66b398e9bd0f1c2ed3d

commit r12-8601-g4ebc9fef1ac36f353866c66b398e9bd0f1c2ed3d
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 31 16:49:08 2022 -0400

    c++: non-dep call with empty TYPE_BINFO [PR105758]

    Here the out-of-line definition of Z<T>::z causes duplicate_decls to
    change z's type from using the primary template type Z<T> (which is also
    the type of the injected class name) to the implicit instantiation Z<T>,
    and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was
    set by a special case in lookup_template_class to point to the former).

    Later, when processing the non-dependent call z->foo(0), build_over_call
    relies on the object argument's TYPE_BINFO to build the templated form
    for this call, which fails because the object argument type has empty
    TYPE_BINFO due to the above.

    It seems weird that the implicit instantiation Z<T> doesn't have the
    same TYPE_BINFO as the primary template type Z<T>, despite them being
    proclaimed equivalent via TYPE_CANONICAL.  So I tried also setting
    TYPE_BINFO in the special case in lookup_template_class, but that led to
    some problems with constrained partial specializations of the form Z<T>.
    I'm not sure what, if anything, we ought to do about the subtle
    differences between these two versions of the same type.

    Fortunately it seems we don't need to rely on TYPE_BINFO at all in
    build_over_call here -- the z_candidate struct already contains the
    exact binfos we need to rebuild the BASELINK for the templated form.

            PR c++/105758

    gcc/cp/ChangeLog:

            * call.cc (build_over_call): Use z_candidate::conversion_path
            and ::access_path instead of TYPE_BINFO when building the
            BASELINK for the templated form.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/non-dependent24.C: New test.

    (cherry picked from commit 4f84f12066953186cce4328b7f178d3daa2fe96e)

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

* [Bug c++/105758] [12 Regression] ICE in build_baselink since r12-6897
  2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-07-21 16:47 ` [Bug c++/105758] [12 " cvs-commit at gcc dot gnu.org
@ 2022-07-21 16:48 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-21 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

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 for GCC 12.2/13

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

end of thread, other threads:[~2022-07-21 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-28 11:46 [Bug c++/105758] New: [12/13 Regression] ICE in build_baselink since r12-6897 jakub at gcc dot gnu.org
2022-05-28 11:47 ` [Bug c++/105758] " jakub at gcc dot gnu.org
2022-05-31 13:24 ` mpolacek at gcc dot gnu.org
2022-05-31 14:45 ` ppalka at gcc dot gnu.org
2022-05-31 20:50 ` cvs-commit at gcc dot gnu.org
2022-07-21 16:47 ` [Bug c++/105758] [12 " cvs-commit at gcc dot gnu.org
2022-07-21 16:48 ` 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).