2007-12-06 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Dec 2007 09:23:00 +0000 (09:23 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Dec 2007 09:23:00 +0000 (09:23 +0000)
        PR fortran/34333
        * primary.c (match_boz_constant): Add gfc_notify_std
        * diagnostics.

2007-12-06  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34333
        * gfortran.dg/boz_7.f90: New.
        * gfortran.dg/int_1.f90: Disable -pedantic option.
        * gfortran.dg/boz_1.f90: Ditto.
        * gfortran.dg/boz_3.f90: Ditto.
        * gfortran.dg/pr16433.f: Accomodate for new BOZ warning.
        * gfortran.dg/ibits.f90: Ditto.
        * gfortran.dg/unf_io_convert_1.f90: Ditto.
        * gfortran.dg/unf_io_convert_2.f90: Ditto.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130644 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/boz_1.f90
gcc/testsuite/gfortran.dg/boz_3.f90
gcc/testsuite/gfortran.dg/boz_7.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/ibits.f90
gcc/testsuite/gfortran.dg/int_1.f90
gcc/testsuite/gfortran.dg/pr16433.f
gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
gcc/testsuite/gfortran.dg/unf_io_convert_2.f90

index b81ecf9..2d5d176 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-06  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34333
+       * primary.c (match_boz_constant): Add gfc_notify_std diagnostics.
+
 2007-12-06  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/34335
index 52977f7..99cdaad 100644 (file)
@@ -351,7 +351,7 @@ match_boz_constant (gfc_expr **result)
 
   if (x_hex && pedantic
       && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal "
-                         "constant at %C uses non-standard syntax.")
+                         "constant at %C uses non-standard syntax")
          == FAILURE))
       return MATCH_ERROR;
 
@@ -388,8 +388,11 @@ match_boz_constant (gfc_expr **result)
        default:
          goto backup;
        }
-       gfc_notify_std (GFC_STD_GNU, "Extension: BOZ constant "
-                       "at %C uses non-standard postfix syntax.");
+
+      if (gfc_notify_std (GFC_STD_GNU, "Extension: BOZ constant "
+                         "at %C uses non-standard postfix syntax")
+         == FAILURE)
+       return MATCH_ERROR;
     }
 
   gfc_current_locus = old_loc;
@@ -419,6 +422,14 @@ match_boz_constant (gfc_expr **result)
       return MATCH_ERROR;
     }
 
+  /* FIXME: Fortran 2003 allows BOZ also in REAL(), CMPLX(), INT();
+     see PR18026 and PR29471.  */
+  if (!gfc_in_match_data ()
+      && (gfc_notify_std (GFC_STD_GNU, "Extension: BOZ used outside a DATA "
+                         "statement at %C")
+         == FAILURE))
+      return MATCH_ERROR;
+
   *result = e;
   return MATCH_YES;
 
index dd41836..e63a9f1 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-06  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34333
+       * gfortran.dg/boz_7.f90: New.
+       * gfortran.dg/int_1.f90: Disable -pedantic option.
+       * gfortran.dg/boz_1.f90: Ditto.
+       * gfortran.dg/boz_3.f90: Ditto.
+       * gfortran.dg/pr16433.f: Accomodate for new BOZ warning.
+       * gfortran.dg/ibits.f90: Ditto.
+       * gfortran.dg/unf_io_convert_1.f90: Ditto.
+       * gfortran.dg/unf_io_convert_2.f90: Ditto.
+
 2007-12-06  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/34335
index abf02d3..d3fa7c7 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-options "-std=gnu" }
 ! Test the boz handling
 program boz
 
index 96184de..e8a93d1 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-options "-std=gnu" }
 ! Test that the BOZ constant on the RHS, which are of different KIND than
 ! the LHS, are correctly converted.
 !
diff --git a/gcc/testsuite/gfortran.dg/boz_7.f90 b/gcc/testsuite/gfortran.dg/boz_7.f90
new file mode 100644 (file)
index 0000000..fea0682
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f95 -pedantic" }
+!
+! PR fortran/34342
+!
+! Some BOZ extensions where not diagnosed
+!
+integer :: k, m
+integer :: j = z'000abc' ! { dg-error "Extension: BOZ used outside a DATA statement" }
+data k/x'0003'/ ! { dg-error "uses non-standard syntax" }
+data m/'0003'z/ ! { dg-error "uses non-standard postfix syntax" }
+end
index e0144ed..93fe58d 100644 (file)
@@ -2,7 +2,7 @@
 ! Test that the mask is properly converted to the kind type of j in ibits.
 program ibits_test
   implicit none
-  integer(8), parameter :: n = z'00000000FFFFFFFF'
+  integer(8), parameter :: n = z'00000000FFFFFFFF' ! { dg-warning "BOZ used outside a DATA statement" }
   integer(8) i,j,k,m
   j = 1
   do i=1,70
index 81937e7..853578e 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-options "-std=gnu" }
 !
 ! 13.7.53    INT(A [, KIND])
 !
index dd8e3fd..df8c418 100644 (file)
@@ -1,6 +1,6 @@
 ! { dg-do compile }
       real x
       double precision dx
-      x = x'2ffde' ! { dg-warning "exadecimal constant" "Hex constant can't begin with x" }
+      data x/x'2ffde'/ ! { dg-warning "exadecimal constant" "Hex constant can't begin with x" }
       dx = x  ! { dg-bogus "exadecimal constant" "Hex constant where there is none" }
       end
index 5fe47c2..bbe02be 100644 (file)
@@ -18,9 +18,9 @@ program main
   integer i
   character*4 str
 
-  m(1) = Z'11223344'
-  m(2) = Z'55667788'
-  n    = Z'77AABBCC'
+  m(1) = Z'11223344' ! { dg-warning "BOZ used outside a DATA statement" }
+  m(2) = Z'55667788' ! { dg-warning "BOZ used outside a DATA statement" }
+  n    = Z'77AABBCC' ! { dg-warning "BOZ used outside a DATA statement" }
   str = 'asdf'
   do i = 1,size
      r(i) = i
@@ -46,7 +46,7 @@ program main
   read(9) str
   !
   ! check results
-  if (m(1).ne.Z'11223344') then
+  if (m(1).ne.Z'11223344') then ! { dg-warning "BOZ used outside a DATA statement" }
      if (debug) then
         print '(A,Z8)','m(1) incorrect.  m(1) = ',m(1)
      else
@@ -54,7 +54,7 @@ program main
      endif
   endif
   
-  if (m(2).ne.Z'55667788') then
+  if (m(2).ne.Z'55667788') then ! { dg-warning "BOZ used outside a DATA statement" }
      if (debug) then
         print '(A,Z8)','m(2) incorrect.  m(2) = ',m(2)
      else
@@ -62,7 +62,7 @@ program main
      endif
   endif
   
-  if (n.ne.Z'77AABBCC') then
+  if (n.ne.Z'77AABBCC') then ! { dg-warning "BOZ used outside a DATA statement" }
      if (debug) then
         print '(A,Z8)','n incorrect.  n = ',n
      else
index f29f6ee..bfb3591 100644 (file)
@@ -15,26 +15,26 @@ program main
   close(10,status="delete")
 
   open (10, form="unformatted",convert="big_endian") ! { dg-warning "Extension: CONVERT" }
-  i = (/ Z'11223344', Z'55667700' /)
+  i = (/ Z'11223344', Z'55667700' /) ! { dg-warning "BOZ used outside a DATA statement" }
   write (10) i
   rewind (10)
   read (10) b
-  if (any(b /= (/ Z'11', Z'22', Z'33', Z'44', Z'55', Z'66', Z'77', Z'00' /))) &
+  if (any(b /= (/ Z'11', Z'22', Z'33', Z'44', Z'55', Z'66', Z'77', Z'00' /))) & ! { dg-warning "BOZ used outside a DATA statement" }
     call abort
   backspace 10
   read (10) j
-  if (j /= Z'1122334455667700') call abort
+  if (j /= Z'1122334455667700') call abort ! { dg-warning "BOZ used outside a DATA statement" }
   close (10, status="delete")
 
   open (10, form="unformatted", convert="little_endian") ! { dg-warning "Extension: CONVERT" }
   write (10) i
   rewind (10)
   read (10) b
-  if (any(b /= (/ Z'44', Z'33', Z'22', Z'11', Z'00', Z'77', Z'66', Z'55' /))) &
+  if (any(b /= (/ Z'44', Z'33', Z'22', Z'11', Z'00', Z'77', Z'66', Z'55' /))) & ! { dg-warning "BOZ used outside a DATA statement" }
     call abort
   backspace 10
   read (10) j
-  if (j /= Z'5566770011223344') call abort
+  if (j /= Z'5566770011223344') call abort ! { dg-warning "BOZ used outside a DATA statement" }
   close (10, status="delete")
 
 end program main