[Fortran, Patch, OpenMP] PR33445 - Warn if (free format) !$OMP& is used as no continuation line

Tobias Burnus burnus@net-b.de
Fri Sep 21 16:05:00 GMT 2007

:ADDPATCH fortran:

In fixed-format, the following two lines form one directive:

!$OMP some-Directive
!$OMP& default(shared)

In free-format Fortran, the latter is no continuation line and thus
treated as comment. As there is no error/warning, one can easily forget
to put the ampersand at the preceding line, when converting
fixed-formatted into free-formatted code. (This can lead to code which
gives wrong results, see example in the PR.)

Other compilers give an error (ifort, sunf95) in this case. As it is
valid ("!$OMP& ..." is a comment line), FX (and Jakub) convinced me that
one should only print a warning and not an error.

The attached patch prints such a warning if it encounters in
free-formatted code  !$OMP&  unless that line is a continuation line:

Warning: Found $!OMP& at (1) but no preceeding directive with a tailing &

Build and regression tested (check-gfortran  + libgomp) on x86-64/Linux.

OK for the trunk?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: omp-warn.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070921/8a151160/attachment.ksh>

More information about the Gcc-patches mailing list