re PR fortran/33445 (Diagnose "!$OMP&" as an error in free format unless it is a...
authorTobias Burnus <burnus@net-b.de>
Sat, 22 Sep 2007 14:20:57 +0000 (16:20 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Sat, 22 Sep 2007 14:20:57 +0000 (16:20 +0200)
2007-09-22  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33445
        * scanner.c (skip_free_comments): Warn if !$OMP& is used
        if no OpenMP directive is to be continued.

2007-09-22  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33445
        * gfortran.dg/gomp/free-2.f90: New.
        * gfortran.dg/gomp/appendix-a/a.31.1.f90: Add missing &.
        * gfortran.dg/gomp/omp_parse1.f90: Add dg-warning.

From-SVN: r128670

gcc/fortran/ChangeLog
gcc/fortran/scanner.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/appendix-a/a.31.1.f90
gcc/testsuite/gfortran.dg/gomp/free-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/omp_parse1.f90

index 586c71919eb7316bd026683be704e920aee22ef1..f683ea3c7f69b129151dab988b0e7ab601963262 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-22  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33445
+       * scanner.c (skip_free_comments): Warn if !$OMP& is used
+       if no OpenMP directive is to be continued.
+
 2007-09-21  Paul Thomas  <pault@gcc.gnu.org>
 
        *trans-expr.c (gfc_trans_pointer_assignment): Convert array
index b0c7979554eab8f8c9fcd3deacbf2789d3d9e5b9..fe7d213ae0bbde0fe830d1d0919d99fa39e1ba45 100644 (file)
@@ -417,18 +417,25 @@ skip_free_comments (void)
                  if (c == 'o' || c == 'O')
                    {
                      if (((c = next_char ()) == 'm' || c == 'M')
-                         && ((c = next_char ()) == 'p' || c == 'P')
-                         && ((c = next_char ()) == ' ' || continue_flag))
+                         && ((c = next_char ()) == 'p' || c == 'P'))
                        {
-                         while (gfc_is_whitespace (c))
-                           c = next_char ();
-                         if (c != '\n' && c != '!')
+                         if ((c = next_char ()) == ' ' || continue_flag)
                            {
-                             openmp_flag = 1;
-                             openmp_locus = old_loc;
-                             gfc_current_locus = start;
-                             return false;
+                             while (gfc_is_whitespace (c))
+                               c = next_char ();
+                             if (c != '\n' && c != '!')
+                               {
+                                 openmp_flag = 1;
+                                 openmp_locus = old_loc;
+                                 gfc_current_locus = start;
+                                 return false;
+                               }
                            }
+                         else
+                           gfc_warning_now ("!$OMP at %C starts a commented "
+                                            "line as it neither is followed "
+                                            "by a space nor is a "
+                                            "continuation line");
                        }
                      gfc_current_locus = old_loc;
                      next_char ();
index 0b3c194e5c0feda488471e898ce856194d2c59e2..96387b225d1939cfa8ed46bcfacf345e362a44b8 100644 (file)
@@ -1,3 +1,10 @@
+2007-09-22  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33445
+       * gfortran.dg/gomp/free-2.f90: New.
+       * gfortran.dg/gomp/appendix-a/a.31.1.f90: Add missing &.
+       * gfortran.dg/gomp/omp_parse1.f90: Add dg-warning.
+
 2007-09-22  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/sse5-hadduX.c: Remove target selector.
index 294926bfdcad85fdc90e994b2eccbf8d70a6d744..7459897ebbdac5e4189146563dc09d4877aee302 100644 (file)
@@ -3,7 +3,7 @@
       SUBROUTINE A31_1(A, B, X, Y, N)
         INTEGER N
         REAL X(*), Y(*), A, B
-!$OMP PARALLEL DO PRIVATE(I) SHARED(X, N) REDUCTION(+:A)
+!$OMP PARALLEL DO PRIVATE(I) SHARED(X, N) REDUCTION(+:A) &
 !$OMP& REDUCTION(MIN:B)
         DO I=1,N
            A = A + X(I)
diff --git a/gcc/testsuite/gfortran.dg/gomp/free-2.f90 b/gcc/testsuite/gfortran.dg/gomp/free-2.f90
new file mode 100644 (file)
index 0000000..60bac66
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/33445
+!
+!$OMP&foo ! { dg-warning "starts a commented line" }
+!
+!$OMP parallel 
+!$OMP& default(shared) ! { dg-warning "starts a commented line" }
+!$OMP end parallel
+!
+!$OMP parallel 
+!$OMP+ default(shared) ! { dg-warning "starts a commented line" }
+!$OMP end parallel
+       end
index 9cd5ebf59c0daab000e3e02bc62e979c99e66d5c..d4137cd11ec2f375a3efb38af7ed7b76d3f6309c 100644 (file)
@@ -17,7 +17,7 @@ call bar
 ! 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
+!$omp  strange  !  { dg-warning "starts a commented line" }
 end
 
 ! { dg-final { scan-tree-dump-times "pragma omp parallel" 3 "omplower" } }