public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays
@ 2021-08-12  9:07 reichelt at gcc dot gnu.org
  2021-08-12  9:12 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for arrays since r12-1933-ge66d0b7b87d105d2 marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-08-12  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101874
           Summary: [12 Regression] ICE with auto specifier for arrays
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The two testcases from PR 60628 and PR 60629 (originally fixed in GCC 4.8.3)
started triggering ICEs again on trunk.

PR 60628:
===============================
#include <initializer_list>

void foo(int i)
{
  auto x[i] = { 0 };
}
===============================

PR 60629:
===============================
void foo(int i)
{
  auto(*p)[i] = (int(*)[i])0;
}
===============================

They also crash in the same functions as before:
tsubst_copy and unify_array_domain
which are eventually called from do_auto_deduction:

PR60628.cc: In function 'void foo(int)':
PR60628.cc:5:11: internal compiler error: in tsubst_copy, at cp/pt.c:17243
    5 |   auto x[i] = { 0 };
      |           ^
0x6e7512 tsubst_copy
        ../../gcc/gcc/cp/pt.c:17243
0xaf1eb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:20870
0xaf3651 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:19639
0xaf46d9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:19815
0xafd357 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:19092
0xb0f64f tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:15475
0xb0f6d3 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:15920
0xaedaff do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:29561
[etc.]


PR60629.cc: In function 'void foo(int)':
PR60629.cc:3:28: internal compiler error: in unify_array_domain, at
cp/pt.c:23278
    3 |   auto(*p)[i] = (int(*)[i])0;
      |                            ^
0x6f380d unify_array_domain
        ../../gcc/gcc/cp/pt.c:23278
0xb0b138 unify
        ../../gcc/gcc/cp/pt.c:23848
0xb0abc9 unify
        ../../gcc/gcc/cp/pt.c:23829
0xb081f0 unify_one_argument
        ../../gcc/gcc/cp/pt.c:22107
0xb154da type_unification_real
        ../../gcc/gcc/cp/pt.c:22226
0xaecaff do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
        ../../gcc/gcc/cp/pt.c:29637
[etc.]


I suspect that the regression was caused by Marek's commit r12-1933.
Marek, could you please have a look?


Unfortunately, the testsuite did not show the regression because it doesn't
contain the original tescases. The second one wasn't added because it was
deemed a duplicate (which makes sense as both ICEs reappered together).

The first testcase was added as g++.dg/cpp0x/auto42.C, but with a subtle
change: 
  auto x[1] = { 0 };
instead of
  auto x[i] = { 0 };
The version in the testsuite actually never showed the ICE.
So we should probably add the original version to the test.

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

* [Bug c++/101874] [12 Regression] ICE with auto specifier for arrays since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
@ 2021-08-12  9:12 ` marxin at gcc dot gnu.org
  2021-08-16  8:53 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-12  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-12
             Status|UNCONFIRMED                 |NEW
                 CC|                            |marxin at gcc dot gnu.org
            Summary|[12 Regression] ICE with    |[12 Regression] ICE with
                   |auto specifier for arrays   |auto specifier for arrays
                   |                            |since
                   |                            |r12-1933-ge66d0b7b87d105d2
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, it really started with r12-1933-ge66d0b7b87d105d2.

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

* [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
  2021-08-12  9:12 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for arrays since r12-1933-ge66d0b7b87d105d2 marxin at gcc dot gnu.org
@ 2021-08-16  8:53 ` rguenth at gcc dot gnu.org
  2021-09-08 15:45 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-16  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
  2021-08-12  9:12 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for arrays since r12-1933-ge66d0b7b87d105d2 marxin at gcc dot gnu.org
  2021-08-16  8:53 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs " rguenth at gcc dot gnu.org
@ 2021-09-08 15:45 ` mpolacek at gcc dot gnu.org
  2022-01-20 12:32 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-09-08 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-09-08 15:45 ` mpolacek at gcc dot gnu.org
@ 2022-01-20 12:32 ` rguenth at gcc dot gnu.org
  2022-01-31 20:36 ` cvs-commit at gcc dot gnu.org
  2022-01-31 20:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-20 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

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++/101874] [12 Regression] ICE with auto specifier for VLAs since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-01-20 12:32 ` rguenth at gcc dot gnu.org
@ 2022-01-31 20:36 ` cvs-commit at gcc dot gnu.org
  2022-01-31 20:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-31 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:874ad5d6745bf3bbe4aa138cef09c669b3fb9b07

commit r12-6952-g874ad5d6745bf3bbe4aa138cef09c669b3fb9b07
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Jan 27 18:11:03 2022 -0500

    c++: ICE with auto[] and VLA [PR102414]

    Here we ICE in unify_array_domain when we're trying to deduce the type
    of an array, as in

      auto(*p)[i] = (int(*)[i])0;

    but unify_array_domain doesn't arbitrarily complex bounds.  Another
    test is, e.g.,

      auto (*b)[0/0] = &a;

    where the type of the array is

      <<< Unknown tree: template_type_parm >>>[0:(sizetype) ((ssizetype) (0 /
0) - 1)]

    It seems to me that we need not handle these.

            PR c++/102414
            PR c++/101874

    gcc/cp/ChangeLog:

            * decl.cc (create_array_type_for_decl): Use template_placeholder_p.
            Sorry on a variable-length array of auto.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp23/auto-array3.C: New test.
            * g++.dg/cpp23/auto-array4.C: New test.

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

* [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs since r12-1933-ge66d0b7b87d105d2
  2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-01-31 20:36 ` cvs-commit at gcc dot gnu.org
@ 2022-01-31 20:38 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-01-31 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-01-31 20:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12  9:07 [Bug c++/101874] New: [12 Regression] ICE with auto specifier for arrays reichelt at gcc dot gnu.org
2021-08-12  9:12 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for arrays since r12-1933-ge66d0b7b87d105d2 marxin at gcc dot gnu.org
2021-08-16  8:53 ` [Bug c++/101874] [12 Regression] ICE with auto specifier for VLAs " rguenth at gcc dot gnu.org
2021-09-08 15:45 ` mpolacek at gcc dot gnu.org
2022-01-20 12:32 ` rguenth at gcc dot gnu.org
2022-01-31 20:36 ` cvs-commit at gcc dot gnu.org
2022-01-31 20:38 ` mpolacek 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).