public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed
@ 2021-12-13 19:56 gscfq@t-online.de
  2021-12-14 10:11 ` [Bug fortran/103695] [12 Regression] ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8 marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2021-12-13 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103695
           Summary: [12 Regression] ICE: verify_ssa failed
           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 20210523 and 20210530, at -O1+ :


$ cat z1.f90
program p
   integer :: i
   do i = 1, 3
      call sub (s(i))
   end do
contains
   function s(n) result(z)
      integer, target, intent(in) :: n
      integer, pointer :: z
      integer :: a(8), b(8), c(8)
      !$omp task affinity (iterator(j=1:8) : a(j), b(j), c(j))
      !$omp end task
      z => n
   end
end


$ gfortran-12-20211212 -c z1.f90 -fopenmp -O0
$
$ gfortran-12-20211212 -c z1.f90 -fopenmp -O2
z1.f90:3:14:

    3 |    do i = 1, 3
      |              ^
Error: virtual definition of statement not up to date
i = 1;
during GIMPLE pass: ssa
z1.f90:3:14: internal compiler error: verify_ssa failed
0x11a066b verify_ssa(bool, bool)
        ../../gcc/tree-ssa.c:1211
0xe14347 execute_function_todo
        ../../gcc/passes.c:2091
0xe14c92 execute_todo
        ../../gcc/passes.c:2138

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

* [Bug fortran/103695] [12 Regression] ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
@ 2021-12-14 10:11 ` marxin at gcc dot gnu.org
  2022-01-04 11:08 ` [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - " rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-14 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-14
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|[12 Regression] ICE:        |[12 Regression] ICE:
                   |verify_ssa failed           |verify_ssa failed since
                   |                            |r12-1108-g9a5de4d5af1c10a8

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

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
  2021-12-14 10:11 ` [Bug fortran/103695] [12 Regression] ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8 marxin at gcc dot gnu.org
@ 2022-01-04 11:08 ` rguenth at gcc dot gnu.org
  2022-01-12  0:58 ` sandra at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-04 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |12.0

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
  2021-12-14 10:11 ` [Bug fortran/103695] [12 Regression] ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8 marxin at gcc dot gnu.org
  2022-01-04 11:08 ` [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - " rguenth at gcc dot gnu.org
@ 2022-01-12  0:58 ` sandra at gcc dot gnu.org
  2022-01-15 21:55 ` sandra at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-12  0:58 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #2 from sandra at gcc dot gnu.org ---
I'm not at all familiar with any of this code (yet), but...

Note that it is complaining about variable i declared in the outer procedure p,
not about something in the nested function s that contains the OMP directives.

Looking at the .original dump, I see that the declaration for the iterator
variable j is appearing in the outer procedure p, not the inner function s
where it is used in the OMP task directive.  The .gimple dump shows both i
*and* j declared in both procedures, and the .nested dump shows that a bunch of
static chain stuff has been added for j.  So my guess is that these variables
being inserted into wrong scopes is confusing the ssa passes.

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-01-12  0:58 ` sandra at gcc dot gnu.org
@ 2022-01-15 21:55 ` sandra at gcc dot gnu.org
  2022-01-15 21:56 ` sandra at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-15 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from sandra at gcc dot gnu.org ---
It appears that the wrong-scope problem is introduced in gfc_finish_var_decl,
in this block of code:

  /* Chain this decl to the pending declarations.  Don't do pushdecl()
     because this would add them to the current scope rather than the
     function scope.  */
  if (current_function_decl != NULL_TREE)
    {
      if (sym->ns->proc_name
          && (sym->ns->proc_name->backend_decl == current_function_decl
              || sym->result == sym))
        gfc_add_decl_to_function (decl);
      else if (sym->ns->proc_name
               && sym->ns->proc_name->attr.flavor == FL_LABEL)
        /* This is a BLOCK construct.  */
        add_decl_as_local (decl);
      else
        gfc_add_decl_to_parent_function (decl);
    }

ns->proc_name contains something completely unexpected here so it's falling
through to gfc_add_decl_to_parent_function.  I think it's an accident that it
works at all when it's not inside a nested function.  Do we really want these
iterator variables to have local scope instead?

gfortran.h documents the proc_name field as

  /* If this is a namespace of a procedure, this points to the procedure.  */
  struct gfc_symbol *proc_name;

but the ASSOCIATED clause seems to be using it for an entirely different
purpose, to chain the list of iterator variables (see handle_iterator in
trans-openmp.c).  I think that's the real bug, rather than the code snippet
quoted above.  It ought to be adding a new field to struct gfc_namespace if
there isn't a better place to store this information, instead of overloading
one that means something else.

I'm still trying to find my way around the code that manipulates these
namespaces and iterator variables.  There's an annoying lack of comments here
to explain the data structures it is using or what parts are handled during
gimplification.  :-(

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-01-15 21:55 ` sandra at gcc dot gnu.org
@ 2022-01-15 21:56 ` sandra at gcc dot gnu.org
  2022-01-19 21:55 ` sandra at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-15 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from sandra at gcc dot gnu.org ---
Ooops, I meant AFFINITY clause in the message above, not ASSOCIATED.

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-01-15 21:56 ` sandra at gcc dot gnu.org
@ 2022-01-19 21:55 ` sandra at gcc dot gnu.org
  2022-01-20 16:01 ` sandra at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-19 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |sandra at gcc dot gnu.org

--- Comment #5 from sandra at gcc dot gnu.org ---
Patch posted here:
https://gcc.gnu.org/pipermail/fortran/2022-January/057425.html

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-01-19 21:55 ` sandra at gcc dot gnu.org
@ 2022-01-20 16:01 ` sandra at gcc dot gnu.org
  2022-01-20 21:30 ` cvs-commit at gcc dot gnu.org
  2022-01-20 21:35 ` sandra at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-20 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from sandra at gcc dot gnu.org ---
*** Bug 102621 has been marked as a duplicate of this bug. ***

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-01-20 16:01 ` sandra at gcc dot gnu.org
@ 2022-01-20 21:30 ` cvs-commit at gcc dot gnu.org
  2022-01-20 21:35 ` sandra at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-20 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <sandra@gcc.gnu.org>:

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

commit r12-6780-gd2ad748eeef0dd260f3993b8dcbffbded3240a0a
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Thu Jan 20 13:29:48 2022 -0800

    Fortran: Fix scope for OMP AFFINITY clause iterator variables [PR103695]

    gfc_finish_var_decl was confused by the undocumented overloading of
    the proc_name field in struct gfc_namespace to contain iterator
    variables for the OpenMP AFFINITY clause, causing it to insert the
    decls in the wrong scope.  This patch adds a new distinct field to
    hold these variables.

    2022-01-20  Sandra Loosemore  <sandra@codesourcery.com>

            PR fortran/103695
            PR fortran/102621

            gcc/fortran
            * gfortran.h (struct gfc_namespace) Add omp_affinity_iterator
            field.
            * dump-parse-tree.cc (show_iterator): Use it.
            * openmp.cc (gfc_match_iterator): Likewise.
            (resolve_omp_clauses): Likewise.
            * trans-decl.cc (gfc_finish_var_decl): Likewise.
            * trans-openmp.cc (handle_iterator): Likewise.

            gcc/testsuite/
            * gfortran.dg/gomp/affinity-clause-3.f90: Adjust pattern.
            * gfortran.dg/gomp/pr102621.f90: New.
            * gfortran.dg/gomp/pr103695.f90: New.

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

* [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
  2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2022-01-20 21:30 ` cvs-commit at gcc dot gnu.org
@ 2022-01-20 21:35 ` sandra at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-20 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

sandra at gcc dot gnu.org changed:

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

--- Comment #8 from sandra at gcc dot gnu.org ---
Should be fixed now.

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

end of thread, other threads:[~2022-01-20 21:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 19:56 [Bug fortran/103695] New: [12 Regression] ICE: verify_ssa failed gscfq@t-online.de
2021-12-14 10:11 ` [Bug fortran/103695] [12 Regression] ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8 marxin at gcc dot gnu.org
2022-01-04 11:08 ` [Bug fortran/103695] [12 Regression][OpenMP] affinity clause - " rguenth at gcc dot gnu.org
2022-01-12  0:58 ` sandra at gcc dot gnu.org
2022-01-15 21:55 ` sandra at gcc dot gnu.org
2022-01-15 21:56 ` sandra at gcc dot gnu.org
2022-01-19 21:55 ` sandra at gcc dot gnu.org
2022-01-20 16:01 ` sandra at gcc dot gnu.org
2022-01-20 21:30 ` cvs-commit at gcc dot gnu.org
2022-01-20 21:35 ` sandra 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).