Commit 0bf0efd5 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/34333 (if(nan == nan) wrongly returns TRUE, when nan is a parameter)

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  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.

From-SVN: r130644
parent df1f30e1
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> 2007-12-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34335 PR fortran/34335
......
...@@ -351,7 +351,7 @@ match_boz_constant (gfc_expr **result) ...@@ -351,7 +351,7 @@ match_boz_constant (gfc_expr **result)
if (x_hex && pedantic if (x_hex && pedantic
&& (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal " && (gfc_notify_std (GFC_STD_GNU, "Extension: Hexadecimal "
"constant at %C uses non-standard syntax.") "constant at %C uses non-standard syntax")
== FAILURE)) == FAILURE))
return MATCH_ERROR; return MATCH_ERROR;
...@@ -388,8 +388,11 @@ match_boz_constant (gfc_expr **result) ...@@ -388,8 +388,11 @@ match_boz_constant (gfc_expr **result)
default: default:
goto backup; 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; gfc_current_locus = old_loc;
...@@ -419,6 +422,14 @@ match_boz_constant (gfc_expr **result) ...@@ -419,6 +422,14 @@ match_boz_constant (gfc_expr **result)
return MATCH_ERROR; 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; *result = e;
return MATCH_YES; 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> 2007-12-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34335 PR fortran/34335
! { dg-do run } ! { dg-do run }
! { dg-options "-std=gnu" }
! Test the boz handling ! Test the boz handling
program boz program boz
......
! { dg-do run } ! { dg-do run }
! { dg-options "-std=gnu" }
! Test that the BOZ constant on the RHS, which are of different KIND than ! Test that the BOZ constant on the RHS, which are of different KIND than
! the LHS, are correctly converted. ! the LHS, are correctly converted.
! !
......
! { 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
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
! Test that the mask is properly converted to the kind type of j in ibits. ! Test that the mask is properly converted to the kind type of j in ibits.
program ibits_test program ibits_test
implicit none 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 integer(8) i,j,k,m
j = 1 j = 1
do i=1,70 do i=1,70
......
! { dg-do run } ! { dg-do run }
! { dg-options "-std=gnu" }
! !
! 13.7.53 INT(A [, KIND]) ! 13.7.53 INT(A [, KIND])
! !
......
! { dg-do compile } ! { dg-do compile }
real x real x
double precision dx 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" } dx = x ! { dg-bogus "exadecimal constant" "Hex constant where there is none" }
end end
...@@ -18,9 +18,9 @@ program main ...@@ -18,9 +18,9 @@ program main
integer i integer i
character*4 str character*4 str
m(1) = Z'11223344' m(1) = Z'11223344' ! { dg-warning "BOZ used outside a DATA statement" }
m(2) = Z'55667788' m(2) = Z'55667788' ! { dg-warning "BOZ used outside a DATA statement" }
n = Z'77AABBCC' n = Z'77AABBCC' ! { dg-warning "BOZ used outside a DATA statement" }
str = 'asdf' str = 'asdf'
do i = 1,size do i = 1,size
r(i) = i r(i) = i
...@@ -46,7 +46,7 @@ program main ...@@ -46,7 +46,7 @@ program main
read(9) str read(9) str
! !
! check results ! 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 if (debug) then
print '(A,Z8)','m(1) incorrect. m(1) = ',m(1) print '(A,Z8)','m(1) incorrect. m(1) = ',m(1)
else else
...@@ -54,7 +54,7 @@ program main ...@@ -54,7 +54,7 @@ program main
endif endif
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 if (debug) then
print '(A,Z8)','m(2) incorrect. m(2) = ',m(2) print '(A,Z8)','m(2) incorrect. m(2) = ',m(2)
else else
...@@ -62,7 +62,7 @@ program main ...@@ -62,7 +62,7 @@ program main
endif endif
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 if (debug) then
print '(A,Z8)','n incorrect. n = ',n print '(A,Z8)','n incorrect. n = ',n
else else
......
...@@ -15,26 +15,26 @@ program main ...@@ -15,26 +15,26 @@ program main
close(10,status="delete") close(10,status="delete")
open (10, form="unformatted",convert="big_endian") ! { dg-warning "Extension: CONVERT" } 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 write (10) i
rewind (10) rewind (10)
read (10) b 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 call abort
backspace 10 backspace 10
read (10) j 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") close (10, status="delete")
open (10, form="unformatted", convert="little_endian") ! { dg-warning "Extension: CONVERT" } open (10, form="unformatted", convert="little_endian") ! { dg-warning "Extension: CONVERT" }
write (10) i write (10) i
rewind (10) rewind (10)
read (10) b 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 call abort
backspace 10 backspace 10
read (10) j 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") close (10, status="delete")
end program main end program main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment