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

	* gfortran.h (struct gfc_namespace) Add omp_affinity_iterator
	* (show_iterator): Use it.
	* (gfc_match_iterator): Likewise.
	(resolve_omp_clauses): Likewise.
	* (gfc_finish_var_decl): Likewise.
	* (handle_iterator): Likewise.

	* gfortran.dg/gomp/affinity-clause-3.f90: Adjust pattern.
	* gfortran.dg/gomp/pr102621.f90: New.
	* gfortran.dg/gomp/pr103695.f90: New.
8 files changed