This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran/OpenMP] Allow more than one space after "!$omp" sentinel


:ADDPATCH fortran:

Currently, gfortran gives an "Unclassifiable OpenMP directive" error
when there is more than one space after the "!$omp" directive. (cf.
http://gcc.gnu.org/ml/fortran/2007-02/msg00305.html).

Unless I misread the standard, multiple spaces are allowed, having one
is mandatory.

The following patch by Bernard Fischer fixes this, by gobbling all extra
spaces.

The patch was regression tested (make check-gfortran, make check in
libgomp) on
x86_64-unknown-linux-gnu.

------------
The OpenMP 2.5 standard states for Fortran free-form source:

http://www.openmp.org/drupal/mp-documents/spec25.pdf
(Words in [ ] brackets are added by me.)

"2.1.2 Free Source Form Directives"
[...]
"The sentinel ["!$omp"] can appear in any column as long as it is
preceded only by white space (spaces and tab characters). It must appear
as a single word with no intervening character. Fortran free form line
length, white space, and continuation rules apply to the directive line.
[>] Initial directive lines must have a space after the sentinel. [<]
Continued directive lines must have an ampersand as the last nonblank
character on the line, prior to any comment placed inside the directive.
Continuation directive lines can have an ampersand after the directive
sentinel with optional white space before and after the
ampersand."
------------


Tobias

PS: I ignore the two regression test errors, which seem to be races:
FAIL: gfortran.dg/secnds-1.f  -Os  execution test
FAIL: gfortran.dg/secnds.f  -O3 -fomit-frame-pointer  execution test

2007-02-15  Bernhard Fischer  <aldot@gcc.gnu.org>

	* parse.c (next_free): Gooble spaces after
	  OpenMP sentinel.

2007-02-15  Tobias Burnus  <burnus@net-b.de>

	* testsuite/libgomp.fortran/character1.f90: Add
	  space-gobbling check.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(Revision 121986)
+++ gcc/fortran/parse.c	(Arbeitskopie)
@@ -485,6 +485,7 @@
 	    gcc_assert (c == "!$omp"[i]);
 
 	  gcc_assert (c == ' ');
+	  gfc_gobble_whitespace ();
 	  return decode_omp_directive ();
 	}
     }
Index: libgomp/testsuite/libgomp.fortran/character1.f90
===================================================================
--- libgomp/testsuite/libgomp.fortran/character1.f90	(Revision 121986)
+++ libgomp/testsuite/libgomp.fortran/character1.f90	(Arbeitskopie)
@@ -22,15 +22,15 @@
     r = ''
     l = .false.
     s = -6
-!$omp parallel firstprivate (f, p, s) private (r, m) reduction (.or.:l) &
-!$omp & num_threads (4)
+!$omp   parallel firstprivate (f, p, s) private (r, m) reduction (.or.:l) &
+!$omp  & num_threads (4)
     m = omp_get_thread_num ()
     if (any (s .ne. -6)) l = .true.
     l = l .or. f .ne. 'test16' .or. p .ne. '01234567'
     l = l .or. g .ne. 'abcdefghijklmnopqrstuvwxyz'
     l = l .or. i .ne. 'ABCDEFGH' .or. q .ne. 'IJKL'
     l = l .or. k .ne. 'MN'
-!$omp barrier
+!$omp  barrier
     if (m .eq. 0) then
       f = 'ffffffff0'
       g = 'xyz'

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]