public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
@ 2023-01-17 17:52 gscfq@t-online.de
  2023-01-17 21:02 ` [Bug c++/108437] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2023-01-17 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108437
           Summary: [13 Regression] ICE in build_min_non_dep_op_overload,
                    at cp/tree.cc:3710
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20221106 and 20221120, with -std=c++23 :


$ cat z1.cc
struct S
{
  static int operator[] (int x) { int a[2]; return a[x]; }
};
template<class T> int f ()
{
  S s;
  s[0]++;
  return 0;
}


$ g++-13-20230115 -c z1.cc -std=c++23
z1.cc: In function 'int f()':
z1.cc:8:6: internal compiler error: in build_min_non_dep_op_overload, at
cp/tree.cc:3710
    8 |   s[0]++;
      |      ^
0xb397f7 build_min_non_dep_op_overload(tree_code, tree_node*, tree_node*, ...)
        ../../gcc/cp/tree.cc:3710
0x92b620 grok_array_decl(unsigned int, tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, int)
        ../../gcc/cp/decl2.cc:577
0xa17963 cp_parser_postfix_open_square_expression
        ../../gcc/cp/parser.cc:8177
0xa2b2de cp_parser_postfix_expression
        ../../gcc/cp/parser.cc:7768
0xa44ddf cp_parser_unary_expression
        ../../gcc/cp/parser.cc:9095
0xa106ef cp_parser_cast_expression
        ../../gcc/cp/parser.cc:9999
0xa1101f cp_parser_binary_expression
        ../../gcc/cp/parser.cc:10101
0xa11da4 cp_parser_assignment_expression
        ../../gcc/cp/parser.cc:10444
0xa14362 cp_parser_expression
        ../../gcc/cp/parser.cc:10614
0xa18577 cp_parser_expression_statement
        ../../gcc/cp/parser.cc:12758
0xa26ae1 cp_parser_statement
        ../../gcc/cp/parser.cc:12538
0xa27de4 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12909
0xa27ec7 cp_parser_compound_statement
        ../../gcc/cp/parser.cc:12861
0xa51d90 cp_parser_function_body
        ../../gcc/cp/parser.cc:25280
0xa51d90 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.cc:25331
0xa5240a cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31953
0xa5393c cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31870
0xa5393c cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22734
0xa5713f cp_parser_single_declaration
        ../../gcc/cp/parser.cc:32470
0xa572a6 cp_parser_template_declaration_after_parameters
        ../../gcc/cp/parser.cc:32023

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

* [Bug c++/108437] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
  2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
@ 2023-01-17 21:02 ` mpolacek at gcc dot gnu.org
  2023-01-18  9:00 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-01-17 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-17
   Target Milestone|---                         |13.0
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-4046.

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

* [Bug c++/108437] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
  2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
  2023-01-17 21:02 ` [Bug c++/108437] " mpolacek at gcc dot gnu.org
@ 2023-01-18  9:00 ` rguenth at gcc dot gnu.org
  2023-01-18 16:23 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-18  9:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/108437] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
  2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
  2023-01-17 21:02 ` [Bug c++/108437] " mpolacek at gcc dot gnu.org
  2023-01-18  9:00 ` rguenth at gcc dot gnu.org
@ 2023-01-18 16:23 ` jakub at gcc dot gnu.org
  2023-01-19 22:31 ` cvs-commit at gcc dot gnu.org
  2023-01-19 22:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-18 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54298
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54298&action=edit
gcc13-pr108437.patch

Untested fix.

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

* [Bug c++/108437] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
  2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-18 16:23 ` jakub at gcc dot gnu.org
@ 2023-01-19 22:31 ` cvs-commit at gcc dot gnu.org
  2023-01-19 22:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-19 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:86caab6c5d1e26e1c54c3dceacc873d6e27bfc09

commit r13-5266-g86caab6c5d1e26e1c54c3dceacc873d6e27bfc09
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 19 23:31:15 2023 +0100

    c++: Fix up handling of non-dependent subscript with static operator[]
[PR108437]

    As the following testcases shows, when adding static operator[]
    support I've missed that the 2 build_min_non_dep_op_overload functions
    need to be adjusted.  The first one we only use for the single index
    case, but as cp_tree_code_length (ARRAY_REF) is 2, we were running
    into an assertion there which compared nargs and expected_nargs.
    For ARRAY_REF, the operator[] is either a non-static member or newly
    static member, never out of class and for the static member case
    if user uses single index the operator[] needs to have a single
    argument as well, but the function is called with 2 - the object
    it is invoked on and the index.  We need to evaluate side-effects
    of the object and use just a single argument in the call - the index.
    The other build_min_non_dep_op_overload overload has been added
    solely for ARRAY_REF - CALL_EXPR is the other operator that accepts
    variable number of operands but that one goes through different
    routines.  There we asserted it is a METHOD_TYPE, so again
    we shouldn't assert that but handle the case when it is not one
    by making sure object's side-effects are evaluated if needed and
    passing all the index arguments to the static operator[].

    2023-01-19  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108437
            * cp-tree.h (keep_unused_object_arg): Declare.
            * call.cc (keep_unused_object_arg): No longer static.
            * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF
            with overload being static member function.

            * g++.dg/cpp23/subscript12.C: New test.
            * g++.dg/cpp23/subscript13.C: New test.

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

* [Bug c++/108437] [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710
  2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-19 22:31 ` cvs-commit at gcc dot gnu.org
@ 2023-01-19 22:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-19 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.  Thanks for the report.

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

end of thread, other threads:[~2023-01-19 22:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 17:52 [Bug c++/108437] New: [13 Regression] ICE in build_min_non_dep_op_overload, at cp/tree.cc:3710 gscfq@t-online.de
2023-01-17 21:02 ` [Bug c++/108437] " mpolacek at gcc dot gnu.org
2023-01-18  9:00 ` rguenth at gcc dot gnu.org
2023-01-18 16:23 ` jakub at gcc dot gnu.org
2023-01-19 22:31 ` cvs-commit at gcc dot gnu.org
2023-01-19 22:33 ` 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).