public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309
@ 2024-09-20 20:13 dcb314 at hotmail dot com
  2024-09-20 20:34 ` [Bug c++/116793] " mpolacek at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2024-09-20 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116793
           Summary: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 59165
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59165&action=edit
gzipped C++ source code

The attached code does this

$ /home/dcb40b/gcc/results.20240909.asan.ubsan/bin/g++ -c -w -std=gnu++20
bug1049.cc
/home/dcb40b/rpmbuild/BUILD/libunifex-0.4.0/test/at_coroutine_exit_test.cpp: In
function ‘void
{anonymous}::AtCoroutineExit::test_mutable_stateful_cleanup_action(_ZN12_GLOBAL__N_115AtCoroutineExit36test_mutable_stateful_cleanup_actionEv.Frame*)’:
/home/dcb40b/rpmbuild/BUILD/libunifex-0.4.0/test/at_coroutine_exit_test.cpp:77:11:
internal compiler error: in gimplify_var_or_parm_decl, at gimplify.cc:3309
   77 |       }, 3);
      |           ^

It used to work with 20240906. The git hashes are g:6a1a856ba78589f7
and g:39a01fcf24676a27.

I have a reduction running.

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

* [Bug c++/116793] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
@ 2024-09-20 20:34 ` mpolacek at gcc dot gnu.org
  2024-09-20 21:49 ` dcb314 at hotmail dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-09-20 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-09-20
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Seems to have started with r15-3513:

commit 964577c31df206d780d5cc7bc07189d44de2719e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Sep 6 13:50:47 2024 +0200

    c++: Partially implement CWG 2867 - Order of initialization for structured
bindings [PR115769]

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

* [Bug c++/116793] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
  2024-09-20 20:34 ` [Bug c++/116793] " mpolacek at gcc dot gnu.org
@ 2024-09-20 21:49 ` dcb314 at hotmail dot com
  2024-09-20 22:18 ` [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513 pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2024-09-20 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dcb314 at hotmail dot com

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
Created attachment 59166
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59166&action=edit
gzipped C++ source code

After more than an hour of cvise, I attach the
partially reduced source code.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
  2024-09-20 20:34 ` [Bug c++/116793] " mpolacek at gcc dot gnu.org
  2024-09-20 21:49 ` dcb314 at hotmail dot com
@ 2024-09-20 22:18 ` pinskia at gcc dot gnu.org
  2024-09-21  1:10 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-20 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing this further.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2024-09-20 22:18 ` [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513 pinskia at gcc dot gnu.org
@ 2024-09-21  1:10 ` pinskia at gcc dot gnu.org
  2024-09-21  1:10 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-21  1:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 59167
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59167&action=edit
Semi reduced with some includes added back

This is the best I could get but I decided to add back tuple and coroutine
headers since I could not get rid of the depedency on std::tuple<Ts &> there.
I tried a normal struct but you need the std::get and friends really otherwise
it would just work it seems.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2024-09-21  1:10 ` pinskia at gcc dot gnu.org
@ 2024-09-21  1:10 ` pinskia at gcc dot gnu.org
  2024-09-21  1:22 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-21  1:10 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-reduction             |
   Target Milestone|---                         |15.0

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2024-09-21  1:10 ` pinskia at gcc dot gnu.org
@ 2024-09-21  1:22 ` pinskia at gcc dot gnu.org
  2024-09-21  9:05 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-21  1:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #59167|0                           |1
        is obsolete|                            |

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 59168
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59168&action=edit
Semi reduced with some includes added back

Like the previous but removal of the un-needed templates.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2024-09-21  1:22 ` pinskia at gcc dot gnu.org
@ 2024-09-21  9:05 ` jakub at gcc dot gnu.org
  2024-09-21 19:44 ` dcb314 at hotmail dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-09-21  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looks like coro lowering bug to me.  The ICE is on Aw0 VAR_DECL which is indeed
used before its declaration:
      {
        struct tuple & D.12700 [value-expr: frame_ptr->_D1_2_0];
        int & i [value-expr: frame_ptr->i_1_2];
        struct tuple D.14203 [value-expr: frame_ptr->_D1_2_1];

                struct tuple D.14203 [value-expr: frame_ptr->_D1_2_1];
                struct tuple & D.12700 [value-expr: frame_ptr->_D1_2_0];
        TARGET_EXPR <D.14220, 0>;
        if (<<cleanup_point !C::await_ready (&Aw0)>>)
          {
            <<cleanup_point <<< Unknown tree: expr_stmt
              (void) (_Coro_resume_index = 4) >>>>>;
            if (<<cleanup_point !C::await_suspend<T::promise_type> (&Aw0,
TARGET_EXPR <D.12788, _Coro_self_handle>)>>)
              {
                <<cleanup_point <<< Unknown tree: expr_stmt
                  .CO_SUSPN (&coro.restart.dispatch) >>>>>;
              }
            switch (<<cleanup_point .CO_YIELD (4, 0, &resume.4, &destroy.4,
frame_ptr)>>)
              {
                case 0:;
                <<cleanup_point <<< Unknown tree: expr_stmt
                  .CO_SUSPN (&actor.suspend.ret) >>>>>;
                case 1:;
                goto resume.4;
                default:;
                goto destroy.4;
              }
            destroy.4:;
            goto coro.delete.promise;
          }
        resume.4:;
        <<cleanup_point {
          struct C Aw0 [value-expr: frame_ptr->Aw0_2_3];
          int T002 [value-expr: frame_ptr->T002_2_3];

                    int T002 [value-expr: frame_ptr->T002_2_3];

All my patch changed is that instead of having one CLEANUP_POINT_EXPR around
the initialization of the unnamed structured binding
base variable and another one around the i there is one around the latter and
one around all that together, i.e. roughly
  <<cleanup_point <<< Unknown tree: expr_stmt
    (void) (D.12700 = D.14203 = <<< Unknown tree: co_await
      TARGET_EXPR <D.12704, func ((int &) &TARGET_EXPR <D.12703, 3>)>
      Aw0
      Aw0 = TARGET_EXPR <D.12704, func ((int &) &TARGET_EXPR <D.12703, 3>)>
      {C::await_ready (&Aw0), C::await_suspend<T::promise_type> (&Aw0,
TARGET_EXPR <D.12788, _Coro_self_handle>), <<< Unknown tree: aggr_init_expr
        4
        await_resume
        D.14196
        &Aw0 >>>}
      0 >>>, (struct tuple &) &D.14203) >>>;
  D.14220 = 1;>>;
    int & i;
  <<cleanup_point <<< Unknown tree: expr_stmt
    (void) (i = std::get<0, int&> (NON_LVALUE_EXPR <D.12700>)) >>>>>;
to:
  <<cleanup_point <<< Unknown tree: expr_stmt
    (void) (D.12700 = D.14203 = <<< Unknown tree: co_await
      TARGET_EXPR <D.12704, func ((int &) &TARGET_EXPR <D.12703, 3>)>
      Aw0
      Aw0 = TARGET_EXPR <D.12704, func ((int &) &TARGET_EXPR <D.12703, 3>)>
      {C::await_ready (&Aw0), C::await_suspend<T::promise_type> (&Aw0,
TARGET_EXPR <D.12788, _Coro_self_handle>), <<< Unknown tree: aggr_init_expr
        4
        await_resume
        D.14196
        &Aw0 >>>}
      0 >>>, (struct tuple &) &D.14203) >>>;
  D.14220 = 1;
    int & i;
  <<cleanup_point <<< Unknown tree: expr_stmt
    (void) (i = std::get<0, int&> (NON_LVALUE_EXPR <D.12700>)) >>>>>;>>;
and (some of the) cleanups on the outer one need to wait until a helper var (I
think D.14220 in this case) is set.

I know really nothing about coroutines.cc to find out what needs to be changed.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2024-09-21  9:05 ` jakub at gcc dot gnu.org
@ 2024-09-21 19:44 ` dcb314 at hotmail dot com
  2024-09-25  9:29 ` sjames at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2024-09-21 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
Created attachment 59172
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59172&action=edit
gzipped C++ source code

A second test case. It crashes in the same place as
the first. Both are from package libunifex in Fedora Rawhide.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2024-09-21 19:44 ` dcb314 at hotmail dot com
@ 2024-09-25  9:29 ` sjames at gcc dot gnu.org
  2024-09-25 13:01 ` arsen at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-09-25  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Sam James <sjames at gcc dot gnu.org> ---
I suspect we're hitting this in qcoro now too.

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2024-09-25  9:29 ` sjames at gcc dot gnu.org
@ 2024-09-25 13:01 ` arsen at gcc dot gnu.org
  2024-09-25 13:40 ` sjames at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: arsen at gcc dot gnu.org @ 2024-09-25 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

Arsen Arsenović <arsen at gcc dot gnu.org> changed:

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

--- Comment #9 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
Created attachment 59191
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59191&action=edit
potential fix

potential fix, yet to convince myself fully it is correct, could you try it
against your testcases (I see no regressions in it against mine and against
folly)

TIA

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2024-09-25 13:01 ` arsen at gcc dot gnu.org
@ 2024-09-25 13:40 ` sjames at gcc dot gnu.org
  2024-09-25 13:50 ` arsen at gcc dot gnu.org
  2024-09-25 14:00 ` sjames at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-09-25 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Arsen Arsenović from comment #9)

This doesn't apply to trunk?

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2024-09-25 13:40 ` sjames at gcc dot gnu.org
@ 2024-09-25 13:50 ` arsen at gcc dot gnu.org
  2024-09-25 14:00 ` sjames at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: arsen at gcc dot gnu.org @ 2024-09-25 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

Arsen Arsenović <arsen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #59191|0                           |1
        is obsolete|                            |

--- Comment #11 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
Created attachment 59193
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59193&action=edit
potential fix

whoops, reversed the operands to git diff.  try this instead (ignore the fuzz,
I did this with ~8 other patches applied to my tree)

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

* [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513
  2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
                   ` (11 preceding siblings ...)
  2024-09-25 13:50 ` arsen at gcc dot gnu.org
@ 2024-09-25 14:00 ` sjames at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-09-25 14:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=940225

--- Comment #12 from Sam James <sjames at gcc dot gnu.org> ---
That fixes qcoro, thank you! I'll let cvise finish on it in case it ends up
being useful.

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

end of thread, other threads:[~2024-09-25 14:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-20 20:13 [Bug c++/116793] New: ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 dcb314 at hotmail dot com
2024-09-20 20:34 ` [Bug c++/116793] " mpolacek at gcc dot gnu.org
2024-09-20 21:49 ` dcb314 at hotmail dot com
2024-09-20 22:18 ` [Bug c++/116793] [15 regression] ice in gimplify_var_or_parm_decl, at gimplify.cc:3309 since r15-3513 pinskia at gcc dot gnu.org
2024-09-21  1:10 ` pinskia at gcc dot gnu.org
2024-09-21  1:10 ` pinskia at gcc dot gnu.org
2024-09-21  1:22 ` pinskia at gcc dot gnu.org
2024-09-21  9:05 ` jakub at gcc dot gnu.org
2024-09-21 19:44 ` dcb314 at hotmail dot com
2024-09-25  9:29 ` sjames at gcc dot gnu.org
2024-09-25 13:01 ` arsen at gcc dot gnu.org
2024-09-25 13:40 ` sjames at gcc dot gnu.org
2024-09-25 13:50 ` arsen at gcc dot gnu.org
2024-09-25 14:00 ` sjames 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).