public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577
@ 2020-11-24 18:30 gscfq@t-online.de
  2020-11-25  8:08 ` [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898 marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2020-11-24 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97973
           Summary: [10/11 Regression] ICE in tsubst_copy_and_build, at
                    cp/pt.c:19577
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started with r10 between 20200119 and 20200126 :


$ cat z1.cc
void a (const int& b);
template <class c> int d { a[1](1.); }


$ g++-11-20201122 -c z1.cc
z1.cc:2:35: internal compiler error: in tsubst_copy_and_build, at cp/pt.c:19577
    2 | template <class c> int d { a[1](1.); }
      |                                   ^
0x768e61 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:19577
0x7688d2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:19477
0x6817cc fold_non_dependent_expr_template
        ../../gcc/cp/constexpr.c:7177
0x6df205 fold_for_warn(tree_node*)
        ../../gcc/cp/expr.c:409
0x800ebc check_function_restrict
        ../../gcc/c-family/c-common.c:5468
0x800ebc check_function_arguments(unsigned int, tree_node const*, tree_node
const*, int, tree_node**, vec<unsigned int, va_heap, vl_ptr>*)
        ../../gcc/c-family/c-common.c:5840
0x7c9607 cp_build_function_call_vec(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int, tree_node*)
        ../../gcc/cp/typeck.c:4024
0x79689f finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/cp/semantics.c:2728
0x73f005 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:7556
0x7471b5 cp_parser_unary_expression
        ../../gcc/cp/parser.c:8659
0x7211ff cp_parser_cast_expression
        ../../gcc/cp/parser.c:9562
0x721a32 cp_parser_binary_expression
        ../../gcc/cp/parser.c:9664
0x7231c0 cp_parser_assignment_expression
        ../../gcc/cp/parser.c:9968
0x7221ad cp_parser_constant_expression
        ../../gcc/cp/parser.c:10264
0x722711 cp_parser_initializer_clause
        ../../gcc/cp/parser.c:23723
0x7228b4 cp_parser_initializer_list
        ../../gcc/cp/parser.c:24002
0x7228b4 cp_parser_braced_list
        ../../gcc/cp/parser.c:23764
0x726082 cp_parser_initializer
        ../../gcc/cp/parser.c:23681
0x74e50e cp_parser_init_declarator
        ../../gcc/cp/parser.c:21323
0x751014 cp_parser_single_declaration
        ../../gcc/cp/parser.c:29997

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

* [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
@ 2020-11-25  8:08 ` marxin at gcc dot gnu.org
  2020-11-25  8:20 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-25  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-11-25
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
            Summary|[10/11 Regression] ICE in   |[10/11 Regression] ICE in
                   |tsubst_copy_and_build, at   |tsubst_copy_and_build, at
                   |cp/pt.c:19577               |cp/pt.c:19577 since
                   |                            |r10-6170-g8a990ffafaaa1898

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started to ICE with r10-6170-g8a990ffafaaa1898.

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

* [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
  2020-11-25  8:08 ` [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898 marxin at gcc dot gnu.org
@ 2020-11-25  8:20 ` rguenth at gcc dot gnu.org
  2021-03-03 21:42 ` [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609 mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-25  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
           Priority|P3                          |P2

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

* [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
  2020-11-25  8:08 ` [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898 marxin at gcc dot gnu.org
  2020-11-25  8:20 ` rguenth at gcc dot gnu.org
@ 2021-03-03 21:42 ` mpolacek at gcc dot gnu.org
  2021-03-03 23:30 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-03 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
           Keywords|ice-on-invalid-code         |ice-on-valid-code
            Summary|[10/11 Regression] ICE in   |[9/10/11 Regression] ICE in
                   |tsubst_copy_and_build, at   |tsubst_copy_and_build, at
                   |cp/pt.c:19577 since         |cp/pt.c:19577 since r265609
                   |r10-6170-g8a990ffafaaa1898  |

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Modified, valid test:

void (*foo[1])(const int &);

template<typename T>
void fn()
{
  (foo[0])(1.1);
}


Started with r265609.

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

* [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-03-03 21:42 ` [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609 mpolacek at gcc dot gnu.org
@ 2021-03-03 23:30 ` mpolacek at gcc dot gnu.org
  2021-03-17 23:34 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-03 23:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-03-03 23:30 ` mpolacek at gcc dot gnu.org
@ 2021-03-17 23:34 ` cvs-commit at gcc dot gnu.org
  2021-03-17 23:36 ` [Bug c++/97973] [9/10 " mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-17 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:40465293cd780aa82dcae75dfcfb1449d8c0561e

commit r11-7709-g40465293cd780aa82dcae75dfcfb1449d8c0561e
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Mar 3 18:37:49 2021 -0500

    c++: ICE with real-to-int conversion in template [PR97973]

    In this test we are building a call in a template, but since neither
    the function nor any of its arguments are dependent, we go down the
    normal path in finish_call_expr.  convert_arguments sees that we're
    binding a reference to int to double and therein convert_to_integer
    creates a FIX_TRUNC_EXPR.  Later, we call check_function_arguments
    which folds the arguments, and, in a template, fold_for_warn calls
    fold_non_dependent_expr.  But tsubst_copy_and_build should not see
    a FIX_TRUNC_EXPR (see the patch discussed in
    <https://gcc.gnu.org/pipermail/gcc-patches/2018-March/496183.html>)
    or we crash.

    So let's not create a FIX_TRUNC_EXPR in a template in the first place
    and instead use IMPLICIT_CONV_EXPR.

    gcc/cp/ChangeLog:

            PR c++/97973
            * call.c (conv_unsafe_in_template_p): New.
            (convert_like): Use it.

    gcc/testsuite/ChangeLog:

            PR c++/97973
            * g++.dg/conversion/real-to-int1.C: New test.

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

* [Bug c++/97973] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-03-17 23:34 ` cvs-commit at gcc dot gnu.org
@ 2021-03-17 23:36 ` mpolacek at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-17 23:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression] ICE in |[9/10 Regression] ICE in
                   |tsubst_copy_and_build, at   |tsubst_copy_and_build, at
                   |cp/pt.c:19577 since r265609 |cp/pt.c:19577 since r265609

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/97973] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-03-17 23:36 ` [Bug c++/97973] [9/10 " mpolacek at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2021-04-10  0:05 ` cvs-commit at gcc dot gnu.org
  2021-04-10  0:06 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ 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=97973

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

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

--- Comment #5 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] 10+ messages in thread

* [Bug c++/97973] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2021-04-10  0:05 ` cvs-commit at gcc dot gnu.org
  2021-04-10  0:06 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-10  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:18f103bd9e5465a10caeb70e2c7890a80c79d60a

commit r10-9692-g18f103bd9e5465a10caeb70e2c7890a80c79d60a
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Apr 9 20:03:45 2021 -0400

    c++: ICE with real-to-int conversion in template [PR97973]

    In this test we are building a call in a template, but since neither
    the function nor any of its arguments are dependent, we go down the
    normal path in finish_call_expr.  convert_arguments sees that we're
    binding a reference to int to double and therein convert_to_integer
    creates a FIX_TRUNC_EXPR.  Later, we call check_function_arguments
    which folds the arguments, and, in a template, fold_for_warn calls
    fold_non_dependent_expr.  But tsubst_copy_and_build should not see
    a FIX_TRUNC_EXPR (see the patch discussed in
    <https://gcc.gnu.org/pipermail/gcc-patches/2018-March/496183.html>)
    or we crash.

    So let's not create a FIX_TRUNC_EXPR in a template in the first place
    and instead use IMPLICIT_CONV_EXPR.

    gcc/cp/ChangeLog:

            PR c++/97973
            * call.c (conv_unsafe_in_template_p): New.
            (convert_like): Use it.

    gcc/testsuite/ChangeLog:

            PR c++/97973
            * g++.dg/conversion/real-to-int1.C: New test.

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

* [Bug c++/97973] [9/10 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609
  2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-04-10  0:05 ` cvs-commit at gcc dot gnu.org
@ 2021-04-10  0:06 ` mpolacek at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-10  0:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in GCC 10.4 too.

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

end of thread, other threads:[~2021-04-10  0:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 18:30 [Bug c++/97973] New: [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 gscfq@t-online.de
2020-11-25  8:08 ` [Bug c++/97973] [10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r10-6170-g8a990ffafaaa1898 marxin at gcc dot gnu.org
2020-11-25  8:20 ` rguenth at gcc dot gnu.org
2021-03-03 21:42 ` [Bug c++/97973] [9/10/11 Regression] ICE in tsubst_copy_and_build, at cp/pt.c:19577 since r265609 mpolacek at gcc dot gnu.org
2021-03-03 23:30 ` mpolacek at gcc dot gnu.org
2021-03-17 23:34 ` cvs-commit at gcc dot gnu.org
2021-03-17 23:36 ` [Bug c++/97973] [9/10 " mpolacek at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-04-10  0:05 ` cvs-commit at gcc dot gnu.org
2021-04-10  0:06 ` mpolacek 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).