re PR fortran/84116 (ICE in gfc_match_omp_clauses, at fortran/openmp.c:1354)
authorJakub Jelinek <jakub@redhat.com>
Wed, 31 Jan 2018 20:47:48 +0000 (21:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 31 Jan 2018 20:47:48 +0000 (21:47 +0100)
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
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr84116.f90 [new file with mode: 0644]

index 70e1494b75a2270d72d1b866cafdd70bb9bf5cf6..649ddd8033af7090df88c34f5eb2dd52eaab2b3f 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-31  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <pault@gcc.gnu.org>
 
        PR fortran/84088
index 2f0fef1f78e60de096e0c1e4b39d88299249876d..5a14925bb61a5e68c4037f8ffdc44fbde571dab4 100644 (file)
@@ -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)
index 3f110a9bf0bd11cdc043b0a422690429c3504d66..4dd7c6df7aaa4425ef100e6179e2e180a53f820c 100644 (file)
@@ -1,5 +1,8 @@
 2018-01-31  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..3a95ac5
--- /dev/null
@@ -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