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

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).