[PATCH] Fix ICE on free form !$omp continued directive followed by OpenMP conditional line (PR fortran/29759)
Jakub Jelinek
jakub@redhat.com
Fri Nov 10 18:42:00 GMT 2006
On Fri, Nov 10, 2006 at 10:42:46AM +0100, Daniel Franke wrote:
> I created a more complete testcase and added it to
> testsuite/gfortran.dg/gomp as pr29759.f90. The patch
> was updated accordingly.
Here is my proposed fix, !$ conditional line should really be clearing
openmp_flag, as it is not OpenMP directive line. The caller then does
all that's needed, i.e. doesn't treat & at the end of last directive line
as continuation character, but as literal & and the parser issues
diagnostics.
Ok for 4.2/4.3?
2006-11-10 Jakub Jelinek <jakub@redhat.com>
PR fortran/29759
* fortran/scanner.c (skip_free_comments): Clear openmp_flag
before returning true.
* gfortran.dg/gomp/pr29759.f90: New test.
--- gcc/fortran/scanner.c.jj 2006-10-22 10:39:36.000000000 +0200
+++ gcc/fortran/scanner.c 2006-11-10 18:55:19.000000000 +0100
@@ -392,6 +392,7 @@ skip_free_comments (void)
{
gfc_current_locus = old_loc;
next_char ();
+ openmp_flag = 0;
return true;
}
}
--- gcc/testsuite/gfortran.dg/gomp/pr29759.f90.jj 2006-11-10 19:05:06.000000000 +0100
+++ gcc/testsuite/gfortran.dg/gomp/pr29759.f90 2006-11-10 19:05:22.000000000 +0100
@@ -0,0 +1,43 @@
+! PR fortran/29759
+! Origin: Daniel Franke <franke.daniel@gmail.com>
+! { dg-do compile }
+
+PROGRAM test_omp
+!$OMP PARALLEL &
+!$OMP NUM_THREADS(2)
+!$OMP END PARALLEL
+
+!$OMP PARALLEL &
+!$OMP & NUM_THREADS(2)
+!$OMP END PARALLEL
+
+!$OMP PARALLEL &
+!
+!$OMP NUM_THREADS(2)
+!$OMP END PARALLEL
+
+!$OMP PARALLEL &
+!
+!$OMP & NUM_THREADS(2)
+!$OMP END PARALLEL
+
+
+!$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" }
+!$ NUM_THREADS(2) ! { dg-error "Unclassifiable" }
+!$OMP END PARALLEL ! { dg-error "Unexpected" }
+
+!$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" }
+!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable" }
+!$OMP END PARALLEL ! { dg-error "Unexpected" }
+
+!$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" }
+!
+!$ NUM_THREADS(2) ! { dg-error "Unclassifiable" }
+!$OMP END PARALLEL ! { dg-error "Unexpected" }
+
+!$OMP PARALLEL & ! { dg-error "Unclassifiable OpenMP" }
+!
+!$ & NUM_THREADS(2) ! { dg-error "Unclassifiable" }
+!$OMP END PARALLEL ! { dg-error "Unexpected" }
+
+END PROGRAM
Jakub
More information about the Gcc-patches
mailing list