* [Bug c++/109319] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
@ 2023-03-28 18:59 ` mpolacek at gcc dot gnu.org
2023-03-29 7:06 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-03-28 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-03-28
CC| |jakub at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-4046-g6492cec069bccf:
commit 6492cec069bccf817ac5e984fb3eca407056a566
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Nov 15 08:00:21 2022 +0100
c++: Implement C++23 P2589R1 - - static operator[]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
2023-03-28 18:59 ` [Bug c++/109319] " mpolacek at gcc dot gnu.org
@ 2023-03-29 7:06 ` rguenth at gcc dot gnu.org
2023-03-29 11:45 ` [Bug c++/109319] [12/13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510 jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-29 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-checking
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
With release checking I see
t.C:3:14: warning: 'static int S::operator[](int)' may be a static member
function only with '-std=c++23' or '-std=gnu++23' [-Wc++23-extensions]
3 | static int operator[] (int x) { int a[2]; return a[x]; }
| ^~~~~~~~
t.C: In function 'int f()':
t.C:8:10: error: lvalue required as increment operand
8 | ++s[0,1];
| ^
t.C: At global scope:
t.C:13:1: error: '$' does not name a type
13 | $ cat z2.cc
| ^
t.C:18:23: error: redefinition of 'template<class T> int f()'
18 | template<class T> int f ()
| ^
t.C:5:23: note: 'template<class T> int f()' previously declared here
5 | template<class T> int f ()
| ^
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12/13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
2023-03-28 18:59 ` [Bug c++/109319] " mpolacek at gcc dot gnu.org
2023-03-29 7:06 ` rguenth at gcc dot gnu.org
@ 2023-03-29 11:45 ` jakub at gcc dot gnu.org
2023-03-29 13:38 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-29 11:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Summary|[13 Regression] ICE in |[12/13 Regression] ICE in
|build_min_non_dep_op_overlo |build_min_non_dep_op_overlo
|ad, at cp/tree.cc:3793 |ad, at cp/tree.cc:3793
| |since r12-5510
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> With release checking I see
Those are two separate testcases which just differ in 0,1 vs. 1,0.
Anyway, adjusted testcase so that it isn't so invalid:
struct S
{
static int &operator[] (int x) { static int a[2]; return a[x]; }
};
template <int N>
int
foo ()
{
S s;
++s[0, 1];
return 0;
}
and without the template <int N> line is accepted with a pedwarn.
And, if it is changed to:
struct S
{
int &operator[] (int x) { static int a[2]; return a[x]; }
};
template <int N>
int
foo ()
{
S s;
++s[0, 1];
return 0;
}
then it is also accepted with pedwarn without the template <int N> line and
otherwise ICEs already starting with r12-5510-gb38c9cf6d570f6.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12/13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
` (2 preceding siblings ...)
2023-03-29 11:45 ` [Bug c++/109319] [12/13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510 jakub at gcc dot gnu.org
@ 2023-03-29 13:38 ` jakub at gcc dot gnu.org
2023-03-30 21:09 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-29 13:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54785
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54785&action=edit
gcc13-pr109319.patch
Untested fix.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12/13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
` (3 preceding siblings ...)
2023-03-29 13:38 ` jakub at gcc dot gnu.org
@ 2023-03-30 21:09 ` cvs-commit at gcc dot gnu.org
2023-04-03 13:16 ` [Bug c++/109319] [12 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-30 21:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:c016887c91a79d67b6a3c7e19b9219f5ab1e2a4d
commit r13-6946-gc016887c91a79d67b6a3c7e19b9219f5ab1e2a4d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 30 23:08:25 2023 +0200
c++: Fix up ICE in build_min_non_dep_op_overload [PR109319]
The following testcase ICEs, because grok_array_decl during
processing_template_decl handling of a non-dependent subscript
emits a -Wcomma-subscript pedwarn, we decide to pass to the
single index argument the index expressions as if it was wrapped
with () around it, but then when preparing it for later instantiation
we don't actually take that into account and ICE on a mismatch of
number of index arguments (the overload expects a single index,
testcase has two index expressions in this case).
For non-dependent subscript which are builtin subscripts we also
emit the same pedwarn and don't ICE, but emit the same pedwarn
again whenever we instantiate it, which is also IMHO undesirable,
it is enough to warn once during parsing the template.
The following patch fixes it by turning even the original index expressions
(those which didn't go through make_args_non_dependent) into a single
index using comma expression(s).
2023-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/109319
* decl2.cc (grok_array_decl): After emitting a pedwarn for
-Wcomma-subscript, if processing_template_decl set orig_index_exp
to compound expr from orig_index_exp_list.
* g++.dg/cpp23/subscript14.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
` (4 preceding siblings ...)
2023-03-30 21:09 ` cvs-commit at gcc dot gnu.org
@ 2023-04-03 13:16 ` jakub at gcc dot gnu.org
2023-04-18 7:16 ` cvs-commit at gcc dot gnu.org
2023-04-18 7:20 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-03 13:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[12/13 Regression] ICE in |[12 Regression] ICE in
|build_min_non_dep_op_overlo |build_min_non_dep_op_overlo
|ad, at cp/tree.cc:3793 |ad, at cp/tree.cc:3793
|since r12-5510 |since r12-5510
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
` (5 preceding siblings ...)
2023-04-03 13:16 ` [Bug c++/109319] [12 " jakub at gcc dot gnu.org
@ 2023-04-18 7:16 ` cvs-commit at gcc dot gnu.org
2023-04-18 7:20 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-18 7:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:6a5c0588ac00f6f55ae7ed2bb791e7e119a01c43
commit r12-9425-g6a5c0588ac00f6f55ae7ed2bb791e7e119a01c43
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 30 23:08:25 2023 +0200
c++: Fix up ICE in build_min_non_dep_op_overload [PR109319]
The following testcase ICEs, because grok_array_decl during
processing_template_decl handling of a non-dependent subscript
emits a -Wcomma-subscript pedwarn, we decide to pass to the
single index argument the index expressions as if it was wrapped
with () around it, but then when preparing it for later instantiation
we don't actually take that into account and ICE on a mismatch of
number of index arguments (the overload expects a single index,
testcase has two index expressions in this case).
For non-dependent subscript which are builtin subscripts we also
emit the same pedwarn and don't ICE, but emit the same pedwarn
again whenever we instantiate it, which is also IMHO undesirable,
it is enough to warn once during parsing the template.
The following patch fixes it by turning even the original index expressions
(those which didn't go through make_args_non_dependent) into a single
index using comma expression(s).
2023-03-30 Jakub Jelinek <jakub@redhat.com>
PR c++/109319
* decl2.cc (grok_array_decl): After emitting a pedwarn for
-Wcomma-subscript, if processing_template_decl set orig_index_exp
to compound expr from orig_index_exp_list.
* g++.dg/cpp23/subscript14.C: New test.
(cherry picked from commit c016887c91a79d67b6a3c7e19b9219f5ab1e2a4d)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/109319] [12 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 since r12-5510
2023-03-28 18:53 [Bug c++/109319] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3793 gscfq@t-online.de
` (6 preceding siblings ...)
2023-04-18 7:16 ` cvs-commit at gcc dot gnu.org
@ 2023-04-18 7:20 ` jakub at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-04-18 7:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109319
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed also for 12.3.
^ permalink raw reply [flat|nested] 9+ messages in thread