public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242
@ 2023-01-17 17:47 gscfq@t-online.de
  2023-01-18  8:48 ` [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c marxin at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2023-01-17 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108435
           Summary: [13 Regression] ICE in as_a, at is-a.h:242
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20220501 and 20220508 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
program p
   integer :: j
contains
   subroutine s
      integer :: i
      !$omp do simd collapse(2)
      do i = 1, 16
         do j = 1, i
         end do
      end do
   end
end


$ cat z2.f90
program p
contains
   subroutine s
      integer :: i, j
      !$omp do simd collapse(2)
      do i = 1, 16
         do j = 1, i
         end do
      end do
   end
end


$ gfortran-13-20230115 -c z2.f90 -fopenmp
$
$ gfortran-13-20230115 -c z1.f90 -fopenmp
z1.f90:1:9:

    1 | program p
      |         ^
internal compiler error: in as_a, at is-a.h:242
0xc3aeba gbind* as_a<gbind*, gimple>(gimple*)
        ../../gcc/is-a.h:242
0xc3aeba declare_vars(tree_node*, gimple*, bool)
        ../../gcc/gimplify.cc:697
0x1053aa7 convert_nonlocal_omp_clauses
        ../../gcc/tree-nested.cc:1590
0x10546d2 convert_nonlocal_reference_stmt
        ../../gcc/tree-nested.cc:1716
0xc34366 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../gcc/gimple-walk.cc:608
0xc34580 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.cc:51
0xc34421 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../gcc/gimple-walk.cc:635
0xc34580 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.cc:51
0x104c788 walk_body
        ../../gcc/tree-nested.cc:811
0x1054616 convert_nonlocal_reference_stmt
        ../../gcc/tree-nested.cc:1752
0xc34366 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../gcc/gimple-walk.cc:608
0xc34580 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.cc:51
0xc34421 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../gcc/gimple-walk.cc:635
0xc34580 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.cc:51
0xc34421 walk_gimple_stmt(gimple_stmt_iterator*, tree_node*
(*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**,
int*, void*), walk_stmt_info*)
        ../../gcc/gimple-walk.cc:635
0xc34580 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*,
bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc/gimple-walk.cc:51
0x104c788 walk_body
        ../../gcc/tree-nested.cc:811
0x104c7d8 walk_function
        ../../gcc/tree-nested.cc:822
0x104c7d8 walk_all_functions
        ../../gcc/tree-nested.cc:887
0x10583b4 lower_nested_functions(tree_node*)
        ../../gcc/tree-nested.cc:3736

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

* [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
@ 2023-01-18  8:48 ` marxin at gcc dot gnu.org
  2023-01-18  8:58 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-18  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |as_a, at is-a.h:242         |as_a, at is-a.h:242 since
                   |                            |r13-142-g705bcedf6eae2d7c
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |sandra at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-142-g705bcedf6eae2d7c.

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

* [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
  2023-01-18  8:48 ` [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c marxin at gcc dot gnu.org
@ 2023-01-18  8:58 ` rguenth at gcc dot gnu.org
  2023-01-19 12:33 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-18  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
  2023-01-18  8:48 ` [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c marxin at gcc dot gnu.org
  2023-01-18  8:58 ` rguenth at gcc dot gnu.org
@ 2023-01-19 12:33 ` jakub at gcc dot gnu.org
  2023-01-20 17:23 ` [Bug middle-end/108435] " burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-19 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
Possibly dup of PR107424 or at least related to that.

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-19 12:33 ` jakub at gcc dot gnu.org
@ 2023-01-20 17:23 ` burnus at gcc dot gnu.org
  2023-02-01 14:24 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-01-20 17:23 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |middle-end
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Possibly dup of PR107424 or at least related to that.

I don't think so.  In any case, it shows also up for C
if one uses the nested-functions extension:


int
main ()
{
  int i, j;
  void bar()
  {
    #pragma omp for simd collapse(2)
     for (i = 1; i <= 16; i++)
       for (j = 1; j <= 16; j++)  /* Note: *no* non-rectangular loop nest.  */
         ;
  }
  bar ();
  return 0;
}


(I get an ICE since GCC 8 and none with GCC 7; thus, I might be a regression,
but I have not checked in depth.)

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-20 17:23 ` [Bug middle-end/108435] " burnus at gcc dot gnu.org
@ 2023-02-01 14:24 ` jakub at gcc dot gnu.org
  2023-02-01 15:29 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-01 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the problem is that normally when gimplifying
OMP_CLAUSE_LASTPRIVATE_STMT we force a BIND_EXPR around it:
              push_gimplify_context ();
              if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
                {
                  tree bind = build3 (BIND_EXPR, void_type_node, NULL,
                                      NULL, NULL);
                  TREE_SIDE_EFFECTS (bind) = 1;
                  BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c);
                  OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind;
                }
              gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c),
                                &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
              pop_gimplify_context
                (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ
(c)));
(similarly for linear), but in this case we do it only conditionally - if
temporaries are needed:
                if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE)
                  seq = &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c);
                else
                  seq = &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c);
                push_gimplify_context ();
                gimplify_assign (decl, t, seq);
                gimple *bind = NULL;
                if (gimplify_ctxp->temps)
                  {
                    bind = gimple_build_bind (NULL_TREE, *seq, NULL_TREE);
                    *seq = NULL;
                    gimplify_seq_add_stmt (seq, bind);
                  }
                pop_gimplify_context (bind);
So, either we do it also unconditionally during gimplify.cc, or in
tree-nested.cc add it later.

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-02-01 14:24 ` jakub at gcc dot gnu.org
@ 2023-02-01 15:29 ` jakub at gcc dot gnu.org
  2023-02-02  8:59 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-01 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2023-02-01

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54385
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54385&action=edit
gcc13-pr108435.patch

Untested fix.

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-02-01 15:29 ` jakub at gcc dot gnu.org
@ 2023-02-02  8:59 ` cvs-commit at gcc dot gnu.org
  2023-02-03 13:57 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-02  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:0f349928e16fdc7dba52561e8d40347909f9f0ff

commit r13-5643-g0f349928e16fdc7dba52561e8d40347909f9f0ff
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 2 09:54:18 2023 +0100

    nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for
declare_vars [PR108435]

    When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
    into a GIMPLE_BIND, but when putting statements directly into
    OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
    are any temporaries that need to be declared in the sequence).
    convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there
always
    because it called declare_vars on it.

    The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
    declare_vars on it on demand.

    2023-02-02  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/108435
            * tree-nested.cc (convert_nonlocal_omp_clauses)
            <case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and
*seq
            is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
            before calling declare_vars.
            (convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
            with the OMP_CLAUSE_LASTPRIVATE handling except for whether
            seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
            or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

            * gcc.dg/gomp/pr108435.c: New test.

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-02-02  8:59 ` cvs-commit at gcc dot gnu.org
@ 2023-02-03 13:57 ` jakub at gcc dot gnu.org
  2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-03 13:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2023-02-03 13:57 ` jakub at gcc dot gnu.org
@ 2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
  2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
  2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:8e74c4389ce242b571cc182b19e88b7c08656145

commit r12-9150-g8e74c4389ce242b571cc182b19e88b7c08656145
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 2 09:54:18 2023 +0100

    nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for
declare_vars [PR108435]

    When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
    into a GIMPLE_BIND, but when putting statements directly into
    OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
    are any temporaries that need to be declared in the sequence).
    convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there
always
    because it called declare_vars on it.

    The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
    declare_vars on it on demand.

    2023-02-02  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/108435
            * tree-nested.cc (convert_nonlocal_omp_clauses)
            <case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and
*seq
            is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
            before calling declare_vars.
            (convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
            with the OMP_CLAUSE_LASTPRIVATE handling except for whether
            seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
            or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

            * gcc.dg/gomp/pr108435.c: New test.

    (cherry picked from commit 0f349928e16fdc7dba52561e8d40347909f9f0ff)

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
  2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:8dbd2cd0729f928cbb0d71d0cebcc8891185d771

commit r11-10707-g8dbd2cd0729f928cbb0d71d0cebcc8891185d771
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 2 09:54:18 2023 +0100

    nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for
declare_vars [PR108435]

    When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
    into a GIMPLE_BIND, but when putting statements directly into
    OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
    are any temporaries that need to be declared in the sequence).
    convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there
always
    because it called declare_vars on it.

    The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
    declare_vars on it on demand.

    2023-02-02  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/108435
            * tree-nested.c (convert_nonlocal_omp_clauses)
            <case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and
*seq
            is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
            before calling declare_vars.
            (convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
            with the OMP_CLAUSE_LASTPRIVATE handling except for whether
            seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
            or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

            * gcc.dg/gomp/pr108435.c: New test.

    (cherry picked from commit 0f349928e16fdc7dba52561e8d40347909f9f0ff)

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

* [Bug middle-end/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c
  2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 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:837723e0543d74663f05e1c000f7ea32e38ded5e

commit r10-11362-g837723e0543d74663f05e1c000f7ea32e38ded5e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 2 09:54:18 2023 +0100

    nested, openmp: Wrap OMP_CLAUSE_*_GIMPLE_SEQ into GIMPLE_BIND for
declare_vars [PR108435]

    When gimplifying OMP_CLAUSE_{LASTPRIVATE,LINEAR}_STMT, we wrap it always
    into a GIMPLE_BIND, but when putting statements directly into
    OMP_CLAUSE_{LASTPRIVATE,LINEAR}_GIMPLE_SEQ, we do it only if needed (there
    are any temporaries that need to be declared in the sequence).
    convert_nonlocal_omp_clauses was relying on the GIMPLE_BIND to be there
always
    because it called declare_vars on it.

    The following patch wraps it into GIMPLE_BIND in tree-nested if we need to
    declare_vars on it on demand.

    2023-02-02  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/108435
            * tree-nested.c (convert_nonlocal_omp_clauses)
            <case OMP_CLAUSE_LASTPRIVATE>: If info->new_local_var_chain and
*seq
            is not a GIMPLE_BIND, wrap the sequence into a new GIMPLE_BIND
            before calling declare_vars.
            (convert_nonlocal_omp_clauses) <case OMP_CLAUSE_LINEAR>: Merge
            with the OMP_CLAUSE_LASTPRIVATE handling except for whether
            seq is initialized to &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (clause)
            or &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (clause).

            * gcc.dg/gomp/pr108435.c: New test.

    (cherry picked from commit 0f349928e16fdc7dba52561e8d40347909f9f0ff)

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

end of thread, other threads:[~2023-05-03 15:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 17:47 [Bug fortran/108435] New: [13 Regression] ICE in as_a, at is-a.h:242 gscfq@t-online.de
2023-01-18  8:48 ` [Bug fortran/108435] [13 Regression] ICE in as_a, at is-a.h:242 since r13-142-g705bcedf6eae2d7c marxin at gcc dot gnu.org
2023-01-18  8:58 ` rguenth at gcc dot gnu.org
2023-01-19 12:33 ` jakub at gcc dot gnu.org
2023-01-20 17:23 ` [Bug middle-end/108435] " burnus at gcc dot gnu.org
2023-02-01 14:24 ` jakub at gcc dot gnu.org
2023-02-01 15:29 ` jakub at gcc dot gnu.org
2023-02-02  8:59 ` cvs-commit at gcc dot gnu.org
2023-02-03 13:57 ` jakub at gcc dot gnu.org
2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
2023-05-03 15: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).