Fortran: fix parsing of omp task affinity iterator clause [PR101330]

gcc/fortran/ChangeLog:

	PR fortran/101330
	* openmp.cc (gfc_match_iterator): Remove left-over code from
	development that could lead to a crash on invalid input.

gcc/testsuite/ChangeLog:

	PR fortran/101330
	* gfortran.dg/gomp/affinity-clause-7.f90: New test.
This commit is contained in:
Harald Anlauf 2022-07-20 20:40:23 +02:00
parent daa36cfc2f
commit 26bbe78f77
2 changed files with 19 additions and 1 deletions

View File

@ -1181,7 +1181,6 @@ gfc_match_iterator (gfc_namespace **ns, bool permit_var)
}
if (':' == gfc_peek_ascii_char ())
{
step = gfc_get_expr ();
if (gfc_match (": %e ", &step) != MATCH_YES)
{
gfc_free_expr (begin);

View File

@ -0,0 +1,19 @@
! { dg-do compile }
! PR fortran/101330 - ICE in free_expr0(): Bad expr type
! Contributed by G.Steinmetz
implicit none
integer :: j, b(10)
!$omp task affinity (iterator(j=1:2:1) : b(j))
!$omp end task
!$omp task affinity (iterator(j=1:2:) : b(j)) ! { dg-error "Invalid character" }
!!$omp end task
!$omp task affinity (iterator(j=1:2: ! { dg-error "Invalid character" }
!!$omp end task
!$omp task affinity (iterator(j=1:2:) ! { dg-error "Invalid character" }
!!$omp end task
!$omp task affinity (iterator(j=1:2::) ! { dg-error "Invalid character" }
!!$omp end task
!$omp task affinity (iterator(j=1:2:)) ! { dg-error "Invalid character" }
!!$omp end task
end