* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
@ 2020-07-30 6:05 ` rguenth at gcc dot gnu.org
2020-07-30 7:41 ` marxin at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-30 6:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.2.0
Target Milestone|--- |10.3
Known to work| |10.1.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
2020-07-30 6:05 ` [Bug c++/96380] " rguenth at gcc dot gnu.org
@ 2020-07-30 7:41 ` marxin at gcc dot gnu.org
2020-07-30 7:41 ` marxin at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-30 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=96379
CC| |marxin at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-2064-g4fd124a23664c712.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
2020-07-30 6:05 ` [Bug c++/96380] " rguenth at gcc dot gnu.org
2020-07-30 7:41 ` marxin at gcc dot gnu.org
@ 2020-07-30 7:41 ` marxin at gcc dot gnu.org
2020-07-30 15:10 ` mpolacek at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-30 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-07-30
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (2 preceding siblings ...)
2020-07-30 7:41 ` marxin at gcc dot gnu.org
@ 2020-07-30 15:10 ` mpolacek at gcc dot gnu.org
2020-10-12 12:40 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-30 15:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
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] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (3 preceding siblings ...)
2020-07-30 15:10 ` mpolacek at gcc dot gnu.org
@ 2020-10-12 12:40 ` rguenth at gcc dot gnu.org
2021-03-29 16:54 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (4 preceding siblings ...)
2020-10-12 12:40 ` rguenth at gcc dot gnu.org
@ 2021-03-29 16:54 ` jakub at gcc dot gnu.org
2021-03-29 17:04 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-29 16:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Keywords| |accepts-invalid
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
extern const int a, b;
enum struct c;
template <class>
enum struct c : union enum struct c { e = b, f = a };
enum class c {};
ICEs even without -fpermissive.
And
extern const int a, b;
enum struct c;
template <class>
enum struct c : union enum struct c { e = b, f = a };
is accepted for some reason, even when for e.g.
template <class>
enum E : int { F };
we reject it:
error: template declaration of ‘enum E’
Marek, have you made any progress on this?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (5 preceding siblings ...)
2021-03-29 16:54 ` jakub at gcc dot gnu.org
@ 2021-03-29 17:04 ` mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-29 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> extern const int a, b;
> enum struct c;
> template <class>
> enum struct c : union enum struct c { e = b, f = a };
> enum class c {};
>
> ICEs even without -fpermissive.
>
> And
> extern const int a, b;
> enum struct c;
> template <class>
> enum struct c : union enum struct c { e = b, f = a };
> is accepted for some reason, even when for e.g.
> template <class>
> enum E : int { F };
> we reject it:
> error: template declaration of ‘enum E’
>
> Marek, have you made any progress on this?
Not yet, sorry. Hopefully this week then.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (6 preceding siblings ...)
2021-03-29 17:04 ` mpolacek at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-20 16:17 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.3 |10.4
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (7 preceding siblings ...)
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-04-20 16:17 ` mpolacek at gcc dot gnu.org
2021-04-20 19:38 ` [Bug c++/96380] [10/11/12 " mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-20 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE |[10/11 Regression] ICE in
|in tree check: expected |tree check: expected
|integer_cst, have |integer_cst, have
|view_convert_expr in |view_convert_expr in
|get_len, at tree.h:5954 |get_len, at tree.h:5954
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> (In reply to Jakub Jelinek from comment #2)
> > Marek, have you made any progress on this?
>
> Not yet, sorry. Hopefully this week then.
Testing a patch now.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11/12 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (8 preceding siblings ...)
2021-04-20 16:17 ` mpolacek at gcc dot gnu.org
@ 2021-04-20 19:38 ` mpolacek at gcc dot gnu.org
2021-04-21 15:12 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-20 19:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 96379 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11/12 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (9 preceding siblings ...)
2021-04-20 19:38 ` [Bug c++/96380] [10/11/12 " mpolacek at gcc dot gnu.org
@ 2021-04-21 15:12 ` cvs-commit at gcc dot gnu.org
2021-04-21 15:14 ` [Bug c++/96380] [10/11 " mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-21 15:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:001c63d15e31bc0a1545426d889a0b9f671b4961
commit r12-42-g001c63d15e31bc0a1545426d889a0b9f671b4961
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Apr 20 12:16:04 2021 -0400
c++: Don't allow defining types in enum-base [PR96380]
In r11-2064 I made cp_parser_enum_specifier commit to tentative parse
when seeing a '{'. That still looks like the correct thing to do, but
it caused an ICE-on-invalid as well as accepts-invalid.
When we have something sneaky like this, which is broken in multiple
ways:
template <class>
enum struct c : union enum struct c { e = b, f = a };
we parse the "enum struct c" part (that's OK) and then we see that
we have an enum-base, so we consume ':' and then parse the type-specifier
that follows the :. "union enum" is clearly invalid, but we're still
parsing tentatively and we parse everything up to the ;, and then
throw away the underlying type. We parsed everything because we were
tricked into parsing an enum-specifier in an enum-base of another
enum-specifier! Not good.
Since the grammar for enum-base doesn't allow a defining-type-specifier,
only a type-specifier, we should set type_definition_forbidden_message
which fixes all the problems in this PR.
gcc/cp/ChangeLog:
PR c++/96380
* parser.c (cp_parser_enum_specifier): Don't allow defining
types in enum-base.
gcc/testsuite/ChangeLog:
PR c++/96380
* g++.dg/cpp0x/enum_base4.C: New test.
* g++.dg/cpp0x/enum_base5.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (10 preceding siblings ...)
2021-04-21 15:12 ` cvs-commit at gcc dot gnu.org
@ 2021-04-21 15:14 ` mpolacek at gcc dot gnu.org
2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
2021-12-02 13:29 ` [Bug c++/96380] [10 " mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-21 15:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE |[10/11 Regression] ICE in
|in tree check: expected |tree check: expected
|integer_cst, have |integer_cst, have
|view_convert_expr in |view_convert_expr in
|get_len, at tree.h:5954 |get_len, at tree.h:5954
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk (GCC 12) so far. Will backport to 11.2 and 10.4. Note: The
patch uses auto, needs tweaking before backporting to 10.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (11 preceding siblings ...)
2021-04-21 15:14 ` [Bug c++/96380] [10/11 " mpolacek at gcc dot gnu.org
@ 2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
2021-12-02 13:29 ` [Bug c++/96380] [10 " mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-27 16:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:af53e450e5c61e36bd01aa2db1251483a60be007
commit r11-8305-gaf53e450e5c61e36bd01aa2db1251483a60be007
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Apr 20 12:16:04 2021 -0400
c++: Don't allow defining types in enum-base [PR96380]
In r11-2064 I made cp_parser_enum_specifier commit to tentative parse
when seeing a '{'. That still looks like the correct thing to do, but
it caused an ICE-on-invalid as well as accepts-invalid.
When we have something sneaky like this, which is broken in multiple
ways:
template <class>
enum struct c : union enum struct c { e = b, f = a };
we parse the "enum struct c" part (that's OK) and then we see that
we have an enum-base, so we consume ':' and then parse the type-specifier
that follows the :. "union enum" is clearly invalid, but we're still
parsing tentatively and we parse everything up to the ;, and then
throw away the underlying type. We parsed everything because we were
tricked into parsing an enum-specifier in an enum-base of another
enum-specifier! Not good.
Since the grammar for enum-base doesn't allow a defining-type-specifier,
only a type-specifier, we should set type_definition_forbidden_message
which fixes all the problems in this PR.
gcc/cp/ChangeLog:
PR c++/96380
* parser.c (cp_parser_enum_specifier): Don't allow defining
types in enum-base.
gcc/testsuite/ChangeLog:
PR c++/96380
* g++.dg/cpp0x/enum_base4.C: New test.
* g++.dg/cpp0x/enum_base5.C: New test.
(cherry picked from commit 001c63d15e31bc0a1545426d889a0b9f671b4961)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/96380] [10 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954
2020-07-29 16:50 [Bug c++/96380] New: [10/11 Regression] ICE in tree check: expected integer_cst, have view_convert_expr in get_len, at tree.h:5954 haoxintu at gmail dot com
` (12 preceding siblings ...)
2021-04-27 16:41 ` cvs-commit at gcc dot gnu.org
@ 2021-12-02 13:29 ` mpolacek at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-02 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96380
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread