public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439
@ 2021-09-21 19:16 gscfq@t-online.de
  2021-09-22  6:58 ` [Bug fortran/102431] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2021-09-21 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102431
           Summary: [12 Regression] ICE in lower_gimple_bind, at
                    gimple-low.c:439
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Changed between 20210530 and 20210606 :


$ cat z1.f90
program p
   integer :: i, a(2)
   !$omp parallel loop reduction(+:a)
   do i = 1, 8
   end do
end


$ gfortran-12-20210919 -c z1.f90 -fopenmp
during GIMPLE pass: lower
z1.f90:3:37:

    3 |    !$omp parallel loop reduction(+:a)
      |                                     ^
internal compiler error: in lower_gimple_bind, at gimple-low.c:439
0x1732df3 lower_gimple_bind
        ../../gcc/gimple-low.c:439
0x173301c lower_stmt
        ../../gcc/gimple-low.c:255
0x173301c lower_sequence
        ../../gcc/gimple-low.c:217
0x1732d38 lower_gimple_bind
        ../../gcc/gimple-low.c:475
0x173301c lower_stmt
        ../../gcc/gimple-low.c:255
0x173301c lower_sequence
        ../../gcc/gimple-low.c:217
0x1732d38 lower_gimple_bind
        ../../gcc/gimple-low.c:475
0x173301c lower_stmt
        ../../gcc/gimple-low.c:255
0x173301c lower_sequence
        ../../gcc/gimple-low.c:217
0x1732f6c lower_omp_directive
        ../../gcc/gimple-low.c:231
0x1732f6c lower_stmt
        ../../gcc/gimple-low.c:399
0x1732f6c lower_sequence
        ../../gcc/gimple-low.c:217
0x1732d38 lower_gimple_bind
        ../../gcc/gimple-low.c:475
0x173301c lower_stmt
        ../../gcc/gimple-low.c:255
0x173301c lower_sequence
        ../../gcc/gimple-low.c:217
0x1732fbc lower_stmt
        ../../gcc/gimple-low.c:286
0x1732fbc lower_sequence
        ../../gcc/gimple-low.c:217
0x1732d38 lower_gimple_bind
        ../../gcc/gimple-low.c:475
0x1733b01 lower_function_body
        ../../gcc/gimple-low.c:110
0x1733b01 execute
        ../../gcc/gimple-low.c:195

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

* [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
@ 2021-09-22  6:58 ` rguenth at gcc dot gnu.org
  2021-09-27 13:15 ` [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-22  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
  2021-09-22  6:58 ` [Bug fortran/102431] " rguenth at gcc dot gnu.org
@ 2021-09-27 13:15 ` marxin at gcc dot gnu.org
  2021-11-19 18:13 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-27 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-09-27
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|[12 Regression] ICE in      |[12 Regression] ICE in
                   |lower_gimple_bind, at       |lower_gimple_bind, at
                   |gimple-low.c:439            |gimple-low.c:439 since
                   |                            |r12-1206-g178191e1dfafd8db
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-1206-g178191e1dfafd8db.

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

* [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
  2021-09-22  6:58 ` [Bug fortran/102431] " rguenth at gcc dot gnu.org
  2021-09-27 13:15 ` [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db marxin at gcc dot gnu.org
@ 2021-11-19 18:13 ` jakub at gcc dot gnu.org
  2021-11-22 15:58 ` [Bug middle-end/102431] " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-19 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
struct S { int s; } s;
void add (struct S *, struct S *);
void init (struct S *);
#pragma omp declare reduction (+:struct S:add (&omp_out, &omp_in)) initializer
(init (&omp_priv))

void
foo (void)
{
  int i;
  #pragma omp loop bind(teams) reduction(+:s)
  for (i = 0; i < 8; i++)
    ;
}

ICEs in both C++ (same spot) and C (different spot) and
struct S { S (); ~S (); S (const S &); void add (const S &); int s; } s;
#pragma omp declare reduction (+:S:omp_out.add (omp_in))

void
foo ()
{
  #pragma omp loop bind(teams) reduction(+:s)
  for (int i = 0; i < 8; i++)
    ;
}
ICEs in C++ too.
I guess gimplify_omp_loop when copying OMP_CLAUSE_REDUCTION_INIT and
OMP_CLAUSE_REDUCTION_MERGE (c) can't just unshare_expr those expressions and
replace the placeholders in there, but needs to also duplicate BLOCKs
referenced in there and adjust them.

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

* [Bug middle-end/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-19 18:13 ` jakub at gcc dot gnu.org
@ 2021-11-22 15:58 ` jakub at gcc dot gnu.org
  2021-11-23  9:33 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-22 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 51848
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51848&action=edit
gcc12-pr102431.patch

Untested fix.

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

* [Bug middle-end/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-11-22 15:58 ` [Bug middle-end/102431] " jakub at gcc dot gnu.org
@ 2021-11-23  9:33 ` cvs-commit at gcc dot gnu.org
  2021-11-26 17:31 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:5e9b973bd60185f221222022f56db7df3d92250e

commit r12-5464-g5e9b973bd60185f221222022f56db7df3d92250e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 23 10:30:02 2021 +0100

    openmp: Fix up handling of reduction clauses on the loop construct
[PR102431]

    We were using unshare_expr and walk_tree_without_duplicate replacement
    of the placeholder vars.  The OMP_CLAUSE_REDUCTION_{INIT,MERGE} can contain
    other trees that need to be duplicated though, e.g. BLOCKs referenced in
    BIND_EXPR(s), or local VAR_DECLs.  This patch uses the inliner code to copy
    all of that.  There is a slight complication that those local VAR_DECLs or
    placeholders don't have DECL_CONTEXT set, they will get that only when
    they are gimplified later on, so this patch sets DECL_CONTEXT for those
    temporarily and resets it afterwards.

    2021-11-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/102431
            * gimplify.c (replace_reduction_placeholders): Remove.
            (note_no_context_vars): New function.
            (gimplify_omp_loop): For OMP_PARALLEL's BIND_EXPR create a new
            BLOCK.  Use copy_tree_body_r with walk_tree instead of unshare_expr
            and replace_reduction_placeholders for duplication of
            OMP_CLAUSE_REDUCTION_{INIT,MERGE} expressions.  Ensure all
mentioned
            automatic vars have DECL_CONTEXT set to non-NULL before doing so
            and reset it afterwards for those vars and their corresponding
            vars.

            * c-c++-common/gomp/pr102431.c: New test.
            * g++.dg/gomp/pr102431.C: New test.
            * gfortran.dg/gomp/pr102431.f90: New test.

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

* [Bug middle-end/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-11-23  9:33 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 17:31 ` jakub at gcc dot gnu.org
  2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
  2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-11-26 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

* [Bug middle-end/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-11-26 17:31 ` jakub at gcc dot gnu.org
@ 2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
  2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-29  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:f578f1828b1429728c5d104adf477859de0cf335

commit r11-9337-gf578f1828b1429728c5d104adf477859de0cf335
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 23 10:30:02 2021 +0100

    openmp: Fix up handling of reduction clauses on the loop construct
[PR102431]

    We were using unshare_expr and walk_tree_without_duplicate replacement
    of the placeholder vars.  The OMP_CLAUSE_REDUCTION_{INIT,MERGE} can contain
    other trees that need to be duplicated though, e.g. BLOCKs referenced in
    BIND_EXPR(s), or local VAR_DECLs.  This patch uses the inliner code to copy
    all of that.  There is a slight complication that those local VAR_DECLs or
    placeholders don't have DECL_CONTEXT set, they will get that only when
    they are gimplified later on, so this patch sets DECL_CONTEXT for those
    temporarily and resets it afterwards.

    2021-11-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/102431
            * gimplify.c (replace_reduction_placeholders): Remove.
            (note_no_context_vars): New function.
            (gimplify_omp_loop): For OMP_PARALLEL's BIND_EXPR create a new
            BLOCK.  Use copy_tree_body_r with walk_tree instead of unshare_expr
            and replace_reduction_placeholders for duplication of
            OMP_CLAUSE_REDUCTION_{INIT,MERGE} expressions.  Ensure all
mentioned
            automatic vars have DECL_CONTEXT set to non-NULL before doing so
            and reset it afterwards for those vars and their corresponding
            vars.

            * c-c++-common/gomp/pr102431.c: New test.
            * g++.dg/gomp/pr102431.C: New test.

    (cherry picked from commit 5e9b973bd60185f221222022f56db7df3d92250e)

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

* [Bug middle-end/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db
  2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
@ 2022-05-10  8:21 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r10-10657-g18e0162ecb5de800f1609bfda657183bf95c7901
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 23 10:30:02 2021 +0100

    openmp: Fix up handling of reduction clauses on the loop construct
[PR102431]

    We were using unshare_expr and walk_tree_without_duplicate replacement
    of the placeholder vars.  The OMP_CLAUSE_REDUCTION_{INIT,MERGE} can contain
    other trees that need to be duplicated though, e.g. BLOCKs referenced in
    BIND_EXPR(s), or local VAR_DECLs.  This patch uses the inliner code to copy
    all of that.  There is a slight complication that those local VAR_DECLs or
    placeholders don't have DECL_CONTEXT set, they will get that only when
    they are gimplified later on, so this patch sets DECL_CONTEXT for those
    temporarily and resets it afterwards.

    2021-11-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/102431
            * gimplify.c (replace_reduction_placeholders): Remove.
            (note_no_context_vars): New function.
            (gimplify_omp_loop): For OMP_PARALLEL's BIND_EXPR create a new
            BLOCK.  Use copy_tree_body_r with walk_tree instead of unshare_expr
            and replace_reduction_placeholders for duplication of
            OMP_CLAUSE_REDUCTION_{INIT,MERGE} expressions.  Ensure all
mentioned
            automatic vars have DECL_CONTEXT set to non-NULL before doing so
            and reset it afterwards for those vars and their corresponding
            vars.

            * c-c++-common/gomp/pr102431.c: New test.
            * g++.dg/gomp/pr102431.C: New test.

    (cherry picked from commit 5e9b973bd60185f221222022f56db7df3d92250e)

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

end of thread, other threads:[~2022-05-10  8:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 19:16 [Bug fortran/102431] New: [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 gscfq@t-online.de
2021-09-22  6:58 ` [Bug fortran/102431] " rguenth at gcc dot gnu.org
2021-09-27 13:15 ` [Bug fortran/102431] [12 Regression] ICE in lower_gimple_bind, at gimple-low.c:439 since r12-1206-g178191e1dfafd8db marxin at gcc dot gnu.org
2021-11-19 18:13 ` jakub at gcc dot gnu.org
2021-11-22 15:58 ` [Bug middle-end/102431] " jakub at gcc dot gnu.org
2021-11-23  9:33 ` cvs-commit at gcc dot gnu.org
2021-11-26 17:31 ` jakub at gcc dot gnu.org
2021-11-29  8:50 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:21 ` cvs-commit 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).