'!' starts in Fortran a comment (+ fixed-form variants)
OpenACC defines as sentinel "!$acc" (likewise)
But OpenMP has two: Besides "!$omp" there is additionally
"!$ " (with space) to permit conditional compilation.
Currently, -fopenacc also executes the '!$ ' code, which I
think does not make sense.
Hence, this patch ignores it.
Comments? If not, I intent to commit it in the next days
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
Fortran: With OpenACC, ignore OpenMP's cond comp sentinels
gcc/fortran/ChangeLog:
PR fortran/98011
* scanner.c (skip_free_comments): If only -fopenacc but not -fopenmp
is used, ignore OpenMP's conditional compilation sentinels.
gcc/testsuite/ChangeLog:
PR fortran/98011
* gfortran.dg/goacc/sentinel-free-form.f95: Update as OpenMP's "!$ "
conditional compilation sentinels are now ignored.
gcc/fortran/scanner.c | 23 ++++++++--------------
.../gfortran.dg/goacc/sentinel-free-form.f95 | 7 +++++--
2 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index fd11f5a244a..b70728d6bd1 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -899,21 +899,14 @@ skip_free_comments (void)
if (next_char () == '$')
{
c = next_char ();
- if (c == 'a' || c == 'A')
- {
- if (skip_free_oacc_sentinel (start, old_loc))
- return false;
- gfc_current_locus = old_loc;
- next_char();
- c = next_char();
- }
- if (continue_flag || c == ' ' || c == '\t')
- {
- gfc_current_locus = old_loc;
- next_char();
- openacc_flag = 0;
- return true;
- }
+ if (c == 'a' || c == 'A')
+ {
+ if (skip_free_oacc_sentinel (start, old_loc))
+ return false;
+ gfc_current_locus = old_loc;
+ next_char();
+ c = next_char();
+ }
}
gfc_current_locus = old_loc;
}
diff --git a/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95 b/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95
index 1a3189cb34e..00dac667ef1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95
@@ -10,7 +10,10 @@ program test
x = 0.0 !$acc parallel ! comment
! sentinel must appear as a single word
! $acc parallel ! comment
- !$ acc parallel ! { dg-error "Unclassifiable statement" }
+
+ ! note that '!$ ' is OpenMP's conditional compilation sentinel
+ !$ acc ignored_due_to_space ! comment
+
! directive lines must have space after sentinel
!$accparallel ! { dg-warning "followed by a space" }
do i = 1,10