[patch, fortran/OpenMP] Allow more than one space after "!$omp" sentinel
Jakub Jelinek
jakub@redhat.com
Thu Feb 15 14:15:00 GMT 2007
On Thu, Feb 15, 2007 at 11:44:06AM +0100, Tobias Burnus wrote:
> The following patch by Bernard Fischer fixes this, by gobbling all extra
> spaces.
The parse.c change looks the best place to fix this, it will handle
even
!$omp &
!$omp & parallel
Here are testcases I wrote for this instead.
2007-02-15 Bernhard Fischer <aldot@gcc.gnu.org>
* parse.c (next_free): Gooble spaces after OpenMP sentinel.
2007-02-15 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/gomp/omp_parse1.f90: New test.
* gfortran.dg/gomp/omp_parse2.f: New test.
--- gcc/fortran/parse.c.jj 2007-01-24 22:24:16.000000000 +0100
+++ gcc/fortran/parse.c 2007-02-15 14:46:07.000000000 +0100
@@ -485,6 +485,7 @@ next_free (void)
gcc_assert (c == "!$omp"[i]);
gcc_assert (c == ' ');
+ gfc_gobble_whitespace ();
return decode_omp_directive ();
}
}
--- gcc/testsuite/gfortran.dg/gomp/omp_parse1.f90.jj 2007-02-15 12:31:31.000000000 +0100
+++ gcc/testsuite/gfortran.dg/gomp/omp_parse1.f90 2007-02-15 15:05:28.000000000 +0100
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-fopenmp -fdump-tree-omplower" }
+ !$omp parallel
+call bar
+ !$omp end parallel
+ !$omp p&
+!$omp&arallel
+call bar
+!$omp e&
+!$omp&ndparallel
+!$omp &
+!$omp & &
+!$omp pa&
+!$omp rallel
+call bar
+!$omp end parallel
+! Non-continuation !$omp must be followed by space, and my reading
+! doesn't seem to allow tab there. So such lines should be completely
+! ignored.
+!$omp strange
+end
+
+! { dg-final { scan-tree-dump-times "pragma omp parallel" 3 "omplower" } }
+! { dg-final { cleanup-tree-dump "omplower" } }
--- gcc/testsuite/gfortran.dg/gomp/omp_parse2.f.jj 2007-02-15 12:31:26.000000000 +0100
+++ gcc/testsuite/gfortran.dg/gomp/omp_parse2.f 2007-02-15 15:06:47.000000000 +0100
@@ -0,0 +1,14 @@
+c { dg-do compile }
+c { dg-options "-fopenmp -fdump-tree-omplower" }
+!$omp parallel
+ call bar
+c$omp end parallel
+C$omp p
+*$omp+arallel
+ call bar
+!$omp e
+!$omp+ndparallel
+ end
+
+! { dg-final { scan-tree-dump-times "pragma omp parallel" 2 "omplower" } }
+! { dg-final { cleanup-tree-dump "omplower" } }
Jakub
More information about the Fortran
mailing list