public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
@ 2022-04-12 17:24 gscfq@t-online.de
  2022-04-12 17:41 ` [Bug c++/105244] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2022-04-12 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105244
           Summary: [9/10/11/12 Regression] ICE in implicitly_declare_fn,
                    at cp/method.cc:3114
           Product: gcc
           Version: 12.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 20190217 and 20190224,
with option -std=c++98 or -std=c++03 :


$ cat z1.cc
template <class T>
struct S
{
  static T max();
};
template <class A = double>
struct V
{
  double a = S<double>::max[1]();
};
template <class T>
V<> foo()
{
  return {};
}
int main()
{
  V<> b = foo<double>();
}


$ g++-12-20220410 -c z1.cc -std=c++03
z1.cc:9:12: warning: non-static data member initializers only available with
'-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
    9 |   double a = S<double>::max[1]();
      |            ^
z1.cc: In function 'V<> foo()':
z1.cc:14:10: warning: extended initializer lists only available with
'-std=c++11' or '-std=gnu++11' [-Wc++11-extensions]
   14 |   return {};
      |          ^
z1.cc:9:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |   double a = S<double>::max[1]();
      |              ~~~~~~~~~~~~~~~~^
z1.cc:14:11: internal compiler error: in implicitly_declare_fn, at
cp/method.cc:3114
   14 |   return {};
      |           ^
0x792b1d implicitly_declare_fn(special_function_kind, tree_node*, bool,
tree_node*, tree_node*)
        ../../gcc/cp/method.cc:3114
0x792f5c lazily_declare_fn(special_function_kind, tree_node*)
        ../../gcc/cp/method.cc:3415
0x7c347c maybe_lazily_declare
        ../../gcc/cp/name-lookup.cc:1896
0x7c347c get_class_binding(tree_node*, tree_node*, bool)
        ../../gcc/cp/name-lookup.cc:1926
0x6dc612 build_user_type_conversion_1
        ../../gcc/cp/call.cc:4151
0x6d54e1 implicit_conversion_1
        ../../gcc/cp/call.cc:2091
0x6d54e1 implicit_conversion
        ../../gcc/cp/call.cc:2132
0x6da2ce perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ../../gcc/cp/call.cc:12710
0x898699 convert_for_initialization(tree_node*, tree_node*, tree_node*, int,
impl_conv_rhs, tree_node*, int, int)
        ../../gcc/cp/typeck.cc:10067
0x8992fe check_return_expr(tree_node*, bool*)
        ../../gcc/cp/typeck.cc:10729
0x85d31e finish_return_stmt(tree_node*)
        ../../gcc/cp/semantics.cc:1195
0x7f3d17 cp_parser_jump_statement
        ../../gcc/cp/parser.cc:14307
0x7f3d17 cp_parser_statement
        ../../gcc/cp/parser.cc:12312
0x7f42f4 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.cc:12850
0x7f43af cp_parser_compound_statement
        ../../gcc/cp/parser.cc:12802
0x812578 cp_parser_function_body
        ../../gcc/cp/parser.cc:25060
0x812578 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.cc:25111
0x812a36 cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.cc:31242
0x813987 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.cc:31158
0x813987 cp_parser_init_declarator
        ../../gcc/cp/parser.cc:22582

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

* [Bug c++/105244] [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
  2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
@ 2022-04-12 17:41 ` mpolacek at gcc dot gnu.org
  2022-04-19 13:08 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-04-12 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P2
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2022-04-12

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r9-6097-g9d35a27a8353b5:

commit 9d35a27a8353b57ed11fa1cb7d747edf1c4faa01
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Feb 19 21:00:29 2019 -0500

    PR c++/88368 - wrong 'use of deleted function'

Unfortunately it wasn't fixed by my

commit d4e0bdbc036644401f9de49f594b2bb16b287381
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Mar 5 15:46:50 2021 -0500

    c++: ICE on invalid with inheriting constructors [PR94751]

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

* [Bug c++/105244] [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
  2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
  2022-04-12 17:41 ` [Bug c++/105244] " mpolacek at gcc dot gnu.org
@ 2022-04-19 13:08 ` jakub at gcc dot gnu.org
  2022-05-27  9:48 ` [Bug c++/105244] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-04-19 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
template <class T>
struct S
{
  static T max ();
};

template <class A = double>
struct V
{
  double a = S<double>::max[0] ();
};

template <class T>
V<>
foo ()
{
  return {};
}

int
main ()
{
  V<> b = foo<double> ();
}

What happens is that synthesized_method_walk with diag = false calls get_nsdmi
with tf_none, and much deeper there is pointer_int_sum which has:
      if (complain && warn_pointer_arith)
        pedwarn (loc, OPT_Wpointer_arith,
                 "pointer to a function used in arithmetic");
      else if (!complain)
        return error_mark_node;
So, if get_nsdmi were called with tf_warning_or_error, we'd pedwarn on it, but
we are quite and just return error_mark_node from get_nsdmi in that case.
So, we end up with raises = error_mark_node and enter:
          /* Can happen, e.g., in C++98 mode for an ill-formed non-static data
             member initializer (c++/89914).  Also, in C++98, we might have
             failed to deduce RAISES, so try again but complain this time.  */
          if (cxx_dialect < cxx11)
            synthesized_method_walk (type, kind, const_p, &raises, nullptr,
                                     nullptr, nullptr, /*diag=*/true,
                                     &inherited_ctor, inherited_parms);
          /* We should have seen an error at this point.  */
          gcc_assert (seen_error ());
and ICE, because at this point whether we pedwarn or not depends on
-Wpointer-arith, and even if not, pedwarn can warn rather than error etc.

Not really sure what to do here, if it is intentional that with tf_none we are
stricter and fail even on things we could just warn or pedwarn without
-pedantic-errors.

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

* [Bug c++/105244] [10/11/12/13 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
  2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
  2022-04-12 17:41 ` [Bug c++/105244] " mpolacek at gcc dot gnu.org
  2022-04-19 13:08 ` jakub at gcc dot gnu.org
@ 2022-05-27  9:48 ` rguenth at gcc dot gnu.org
  2022-06-28 10:49 ` jakub at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug c++/105244] [11/12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c++/105244] [10/11/12/13 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
  2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-05-27  9:48 ` [Bug c++/105244] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:49 ` jakub at gcc dot gnu.org
  2023-07-07 10:43 ` [Bug c++/105244] [11/12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/105244] [11/12/13/14 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114
  2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-06-28 10:49 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:43 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 17:24 [Bug c++/105244] New: [9/10/11/12 Regression] ICE in implicitly_declare_fn, at cp/method.cc:3114 gscfq@t-online.de
2022-04-12 17:41 ` [Bug c++/105244] " mpolacek at gcc dot gnu.org
2022-04-19 13:08 ` jakub at gcc dot gnu.org
2022-05-27  9:48 ` [Bug c++/105244] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:49 ` jakub at gcc dot gnu.org
2023-07-07 10:43 ` [Bug c++/105244] [11/12/13/14 " rguenth 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).