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
+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
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;
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;
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;
+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
! { dg-do run }
+! { dg-options "-std=gnu" }
! Test the boz handling
program boz
! { 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.
!
--- /dev/null
+! { 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
! 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
! { dg-do run }
+! { dg-options "-std=gnu" }
!
! 13.7.53 INT(A [, KIND])
!
! { 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
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
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
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
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
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