[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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.
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103695 --- Comment #7 from CVS Commits --- The master branch has been updated by Sandra Loosemore : https://gcc.gnu.org/g:d2ad748eeef0dd260f3993b8dcbffbded3240a0a commit r12-6780-gd2ad748eeef0dd260f3993b8dcbffbded3240a0a Author: Sandra Loosemore 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 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.
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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. ***
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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.
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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. :-(
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
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.
[Bug fortran/103695] [12 Regression][OpenMP] affinity clause - ICE: verify_ssa failed since r12-1108-g9a5de4d5af1c10a8
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103695 Richard Biener changed: What|Removed |Added Priority|P3 |P1 Target Milestone|--- |12.0