public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469
@ 2023-01-23 12:11 jakub at gcc dot gnu.org
  2023-01-23 12:11 ` [Bug c++/108496] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-23 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108496
           Summary: [13 Regression] NRV ICE since r13-4469
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r13-4469-gd19aa6af6634b1e97f38431ad091f3b3f12baf2f we ICE with -O2 on:
struct S { long a, b, c; } s;

template <int, typename>
S foo (S);

template <>
S
foo <0, long> (S)
{
  return s;
}

template S foo <0, long> (S);

during GIMPLE pass: nrv
rh2163383.ii: In function ‘S foo(S) [with int <anonymous> = 0;
<template-parameter-1-2> = long int]’:
rh2163383.ii:8:1: internal compiler error: in execute, at tree-nrv.cc:179
    8 | foo <0, long> (S)
      | ^~~~~~~~~~~~~
tree-nrv.cc:179 is:
                gcc_assert (ret_val == result);

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

* [Bug c++/108496] [13 Regression] NRV ICE since r13-4469
  2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
@ 2023-01-23 12:11 ` jakub at gcc dot gnu.org
  2023-01-23 13:01 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-23 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldot at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.0
   Last reconfirmed|                            |2023-01-23
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P1

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

* [Bug c++/108496] [13 Regression] NRV ICE since r13-4469
  2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
  2023-01-23 12:11 ` [Bug c++/108496] " jakub at gcc dot gnu.org
@ 2023-01-23 13:01 ` rguenth at gcc dot gnu.org
  2023-01-23 14:49 ` jason 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-23 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  With -O0 we ICE like

> ./cc1plus -quiet t.ii   
during RTL pass: expand
t.ii: In function 'S foo(S) [with int <anonymous> = 0; <template-parameter-1-2>
= long int]':
t.ii:10:10: internal compiler error: in make_decl_rtl, at varasm.cc:1439
   10 |   return s;
      |          ^
0x1eaa4a7 make_decl_rtl(tree_node*)
        /home/rguenther/src/trunk/gcc/varasm.cc:1438
0x14421f3 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /home/rguenther/src/trunk/gcc/expr.cc:10870
0x1439718 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        /home/rguenther/src/trunk/gcc/expr.cc:9004
0x1414a44 expand_expr
        /home/rguenther/src/trunk/gcc/expr.h:310
0x142c41f expand_assignment(tree_node*, tree_node*, bool)
        /home/rguenther/src/trunk/gcc/expr.cc:5987

it looks like there's a stray RESULT_DECL w/o DECL_CONTEXT in this function
allocated by

0x0000000000de99c0 in grokdeclarator (declarator=0x4870c40,
declspecs=0x7fffffffda30, decl_context=NORMAL, initialized=0,
attrlist=0x7fffffffdaa0) at /home/rguenther/src/trunk/gcc/cp/decl.cc:14782
14782               tree resdecl = build_decl (loc, RESULT_DECL, 0, restype);
Value returned is $9 = (tree_node *) 0x7ffff642a0f0
(gdb) l
14777           /* If we saw a return type, record its location.  */
14778           location_t loc = declspecs->locations[ds_type_spec];
14779           if (loc != UNKNOWN_LOCATION)
14780             {
14781               tree restype = TREE_TYPE (TREE_TYPE (decl));
14782               tree resdecl = build_decl (loc, RESULT_DECL, 0, restype);
14783               DECL_ARTIFICIAL (resdecl) = 1;
14784               DECL_IGNORED_P (resdecl) = 1;
14785               DECL_RESULT (decl) = resdecl;

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

* [Bug c++/108496] [13 Regression] NRV ICE since r13-4469
  2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
  2023-01-23 12:11 ` [Bug c++/108496] " jakub at gcc dot gnu.org
  2023-01-23 13:01 ` rguenth at gcc dot gnu.org
@ 2023-01-23 14:49 ` jason at gcc dot gnu.org
  2023-01-23 19:09 ` cvs-commit at gcc dot gnu.org
  2023-01-23 19:10 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2023-01-23 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/108496] [13 Regression] NRV ICE since r13-4469
  2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-23 14:49 ` jason at gcc dot gnu.org
@ 2023-01-23 19:09 ` cvs-commit at gcc dot gnu.org
  2023-01-23 19:10 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-23 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:4b125d01a5d5e601961419396332b74eea2219bb

commit r13-5310-g4b125d01a5d5e601961419396332b74eea2219bb
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jan 23 13:33:07 2023 -0500

    c++: result location and explicit inst [PR108496]

    In r13-4469 we started to build the RESULT_DECL in grokdeclarator, while we
    still know the location of the return type.  But in this testcase, we hit
    that code again when parsing the explicit instantiation, and clobber the
    DECL_RESULT that was previously used in parsing the function.  So, only set
    DECL_RESULT if it isn't already set.

            PR c++/108496

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Check whether DECL_RESULT is already
            set.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/explicit-instantiation5.C: New test.

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

* [Bug c++/108496] [13 Regression] NRV ICE since r13-4469
  2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-23 19:09 ` cvs-commit at gcc dot gnu.org
@ 2023-01-23 19:10 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2023-01-23 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 12:11 [Bug c++/108496] New: [13 Regression] NRV ICE since r13-4469 jakub at gcc dot gnu.org
2023-01-23 12:11 ` [Bug c++/108496] " jakub at gcc dot gnu.org
2023-01-23 13:01 ` rguenth at gcc dot gnu.org
2023-01-23 14:49 ` jason at gcc dot gnu.org
2023-01-23 19:09 ` cvs-commit at gcc dot gnu.org
2023-01-23 19:10 ` jason 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).