From c9243c043c06d0f8576ff4f76b92d41143d2fc2e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 31 Jan 2018 21:47:48 +0100 Subject: [PATCH] re PR fortran/84116 (ICE in gfc_match_omp_clauses, at fortran/openmp.c:1354) PR fortran/84116 * openmp.c (gfc_match_omp_clauses): If all the linear gfc_match_omp_variable_list calls failed, don't gfc_free_omp_namelist nor set *head = NULL. Formatting fixes. * gfortran.dg/gomp/pr84116.f90: New test. From-SVN: r257266 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/openmp.c | 8 +++----- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gfortran.dg/gomp/pr84116.f90 | 12 ++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/gomp/pr84116.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 70e1494b75a..649ddd8033a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-01-31 Jakub Jelinek + + PR fortran/84116 + * openmp.c (gfc_match_omp_clauses): If all the linear + gfc_match_omp_variable_list calls failed, don't gfc_free_omp_namelist + nor set *head = NULL. Formatting fixes. + 2018-01-31 Paul Thomas PR fortran/84088 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 2f0fef1f78e..5a14925bb61 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1318,23 +1318,21 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, else if (gfc_match_omp_variable_list (" val (", &c->lists[OMP_LIST_LINEAR], false, NULL, &head) - == MATCH_YES) + == MATCH_YES) linear_op = OMP_LINEAR_VAL; else if (gfc_match_omp_variable_list (" uval (", &c->lists[OMP_LIST_LINEAR], false, NULL, &head) - == MATCH_YES) + == MATCH_YES) linear_op = OMP_LINEAR_UVAL; else if (gfc_match_omp_variable_list ("", &c->lists[OMP_LIST_LINEAR], false, &end_colon, &head) - == MATCH_YES) + == MATCH_YES) linear_op = OMP_LINEAR_DEFAULT; else { - gfc_free_omp_namelist (*head); gfc_current_locus = old_loc; - *head = NULL; break; } if (linear_op != OMP_LINEAR_DEFAULT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f110a9bf0b..4dd7c6df7aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-01-31 Jakub Jelinek + PR fortran/84116 + * gfortran.dg/gomp/pr84116.f90: New test. + PR c++/83993 * g++.dg/init/pr83993-2.C: New test. diff --git a/gcc/testsuite/gfortran.dg/gomp/pr84116.f90 b/gcc/testsuite/gfortran.dg/gomp/pr84116.f90 new file mode 100644 index 00000000000..3a95ac5f36f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr84116.f90 @@ -0,0 +1,12 @@ +! PR fortran/84116 +! { dg-do compile } + +program pr84116 + integer :: i, j + !$omp simd linear ((i)) ! { dg-error "Syntax error" } + do i = 1, 2 + end do + !$omp simd linear () ! { dg-error "Syntax error" } + do j = 1, 2 + end do +end -- 2.30.2