public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112365] New: [14 regression] ICE on invalid C++
@ 2023-11-03  8:15 sjames at gcc dot gnu.org
  2023-11-03  8:33 ` [Bug c++/112365] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-03  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112365
           Summary: [14 regression] ICE on invalid C++
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

This came from a (bad) reduction from a user downstream for another bug we'll
file shortly.

```
template <typename> struct ResolvedColorType;
         template < typename ColorType > ResolvedColorType< ColorType >
resolvedColor(ColorType;
         template < typename ColorType > struct ResolvedColorType {
  constexpr ResolvedColorType : ColorType {}        }
         struct {                 resolved( {
  resolvedColor(this)
```

```
$ g++-14 /tmp/foo.cxx
/tmp/foo.cxx:2:96: error: expected ‘)’ before ‘;’ token
    2 |          template < typename ColorType > ResolvedColorType< ColorType >
resolvedColor(ColorType;
      |                                                                        
             ~         ^
      |                                                                        
                       )
/tmp/foo.cxx:4:3: error: non-static data member ‘’ declared ‘constexpr’
    4 |   constexpr ResolvedColorType : ColorType {}        }
      |   ^~~~~~~~~
/tmp/foo.cxx:4:44: error: expected ‘;’ at end of member declaration
    4 |   constexpr ResolvedColorType : ColorType {}        }
      |                                            ^
      |                                             ;
/tmp/foo.cxx:4:54: error: expected ‘;’ after struct definition
    4 |   constexpr ResolvedColorType : ColorType {}        }
      |                                                      ^
      |                                                      ;
/tmp/foo.cxx:5:45: error: expected identifier before ‘{’ token
    5 |          struct {                 resolved( {
      |                                             ^
/tmp/foo.cxx:5:44: error: expected ‘)’ before ‘{’ token
    5 |          struct {                 resolved( {
      |                                           ~^~
      |                                            )
/tmp/foo.cxx:5:35: error: ISO C++ forbids declaration of ‘resolved’ with no
type [-fpermissive]
    5 |          struct {                 resolved( {
      |                                   ^~~~~~~~
/tmp/foo.cxx:6:22: error: expected ‘}’ at end of input
    6 |   resolvedColor(this)
      |                      ^
/tmp/foo.cxx:5:17: note: to match this ‘{’
    5 |          struct {                 resolved( {
      |                 ^
/tmp/foo.cxx: In instantiation of ‘struct ResolvedColorType<<unnamed
struct>*>’:
/tmp/foo.cxx:6:16:   required from here
/tmp/foo.cxx:5:17: note:     6 |   resolvedColor(this)
/tmp/foo.cxx:5:17: note:       |   ~~~~~~~~~~~~~^~~~~~
/tmp/foo.cxx:4:44: error: ‘ResolvedColorType< <template-parameter-1-1>
>::<anonymous>’ has incomplete type
    4 |   constexpr ResolvedColorType : ColorType {}        }
      |                                            ^
/tmp/foo.cxx:3:49: note: definition of ‘struct ResolvedColorType<<unnamed
struct>*>’ is not complete until the closing brace
    3 |          template < typename ColorType > struct ResolvedColorType {
      |                                                 ^~~~~~~~~~~~~~~~~
/tmp/foo.cxx:3:49: internal compiler error: in layout_class_type, at
cp/class.cc:6966
0x5643dcc7dd8e layout_class_type(tree_node*, tree_node**) [clone .constprop.0]
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/class.cc:6966
0x5643de537884 finish_struct_1(tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/class.cc:7601
0x5643de854da8 instantiate_class_template(tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/pt.cc:12569
0x5643de33ae80 complete_type(tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/typeck.cc:138
0x5643de33ae80 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/typeck.cc:151
0x5643de5f3da2 require_complete_type(tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/typeck.cc:94
0x5643de5f3da2 build_cxx_call(tree_node*, int, tree_node**, int, tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/call.cc:10941
0x5643de5d8d5c build_over_call
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/call.cc:10426
0x5643de5c10b2 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/call.cc:5026
0x5643de5bb166 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/semantics.cc:2981
0x5643de4ddb17 cp_parser_postfix_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:8084
0x5643de4d9a39 cp_parser_binary_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:10229
0x5643de4d8cd8 cp_parser_assignment_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:10573
0x5643de4decdd cp_parser_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:10740
0x5643de4decdd cp_parser_expression_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:12939
0x5643de4d5671 cp_parser_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:12719
0x5643de4d2015 cp_parser_statement_seq_opt
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:13188
0x5643de4d2015 cp_parser_compound_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:13042
0x5643de4ce999 cp_parser_function_body
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:25560
0x5643de4ce999 cp_parser_ctor_initializer_opt_and_function_body
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231029/gcc-14-20231029/gcc/cp/parser.cc:25611
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

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

* [Bug c++/112365] [14 regression] ICE on invalid C++
  2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
@ 2023-11-03  8:33 ` rguenth at gcc dot gnu.org
  2023-11-03 14:26 ` [Bug c++/112365] " sjames at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-03  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
   Target Milestone|---                         |14.0

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

* [Bug c++/112365] ICE on invalid C++
  2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
  2023-11-03  8:33 ` [Bug c++/112365] " rguenth at gcc dot gnu.org
@ 2023-11-03 14:26 ` sjames at gcc dot gnu.org
  2023-11-03 14:39 ` [Bug c++/112365] [12/13/14 Regression] " mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-03 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-checking
            Summary|[14 regression] ICE on      |ICE on invalid C++
                   |invalid C++                 |

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
It looks like this is actually present for 13+12 at the very least, just needs
checking.

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

* [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++
  2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
  2023-11-03  8:33 ` [Bug c++/112365] " rguenth at gcc dot gnu.org
  2023-11-03 14:26 ` [Bug c++/112365] " sjames at gcc dot gnu.org
@ 2023-11-03 14:39 ` mpolacek at gcc dot gnu.org
  2023-11-16 16:43 ` [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++ since r12-3324 cvs-commit at gcc dot gnu.org
  2023-11-16 16:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-11-03 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
     Ever confirmed|0                           |1
            Summary|ICE on invalid C++          |[12/13/14 Regression] ICE
                   |                            |on invalid C++
   Last reconfirmed|                            |2023-11-03
             Status|UNCONFIRMED                 |NEW
   Target Milestone|14.0                        |12.4
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-3324:

commit e902136b310ee17d4b49eb42d9d5e487d5dcf4a1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Sep 3 09:46:32 2021 +0200

    c++, abi: Set DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD on C++ zero width
bitfields [PR102024]

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

* [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++ since r12-3324
  2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-11-03 14:39 ` [Bug c++/112365] [12/13/14 Regression] " mpolacek at gcc dot gnu.org
@ 2023-11-16 16:43 ` cvs-commit at gcc dot gnu.org
  2023-11-16 16:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-16 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:0fa32aeaa6da4ef9566d98a6fb541dd7427d7d36

commit r14-5534-g0fa32aeaa6da4ef9566d98a6fb541dd7427d7d36
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Nov 16 17:42:22 2023 +0100

    c++: Fix error recovery ICE [PR112365]

    check_field_decls for DECL_C_BIT_FIELD FIELD_DECLs with error_mark_node
    TREE_TYPE continues early and doesn't call check_bitfield_decl which would
    either set DECL_BIT_FIELD, or clear DECL_C_BIT_FIELD.  So, the following
    testcase ICEs after emitting tons of errors, because
    SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD asserts DECL_BIT_FIELD.

    The patch skips that for FIELD_DECLs with error_mark_node, another
    option would be to check DECL_BIT_FIELD in addition to DECL_C_BIT_FIELD.

    2023-11-16  Jakub Jelinek  <jakub@redhat.com>

            PR c++/112365
            * class.cc (layout_class_type): Don't
            SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD on FIELD_DECLs with
            error_mark_node type.

            * g++.dg/cpp0x/pr112365.C: New test.

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

* [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++ since r12-3324
  2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-16 16:43 ` [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++ since r12-3324 cvs-commit at gcc dot gnu.org
@ 2023-11-16 16:44 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-16 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|12.4                        |14.0

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk.
ice-on-invalid, so not suitable for backporting.

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

end of thread, other threads:[~2023-11-16 16:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03  8:15 [Bug c++/112365] New: [14 regression] ICE on invalid C++ sjames at gcc dot gnu.org
2023-11-03  8:33 ` [Bug c++/112365] " rguenth at gcc dot gnu.org
2023-11-03 14:26 ` [Bug c++/112365] " sjames at gcc dot gnu.org
2023-11-03 14:39 ` [Bug c++/112365] [12/13/14 Regression] " mpolacek at gcc dot gnu.org
2023-11-16 16:43 ` [Bug c++/112365] [12/13/14 Regression] ICE on invalid C++ since r12-3324 cvs-commit at gcc dot gnu.org
2023-11-16 16:44 ` jakub 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).