diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-07-23 21:43:21 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2019-07-23 21:43:21 +0000 |
commit | 8dc63166e0b859546ba53093c5fc6c09925210dd (patch) | |
tree | d8cd9da5b8bca4b00b103577f9637fb996d8024a /gcc/testsuite | |
parent | 000a002072d04d70bcd1d4be0daf8838035afa23 (diff) | |
download | gcc-8dc63166e0b859546ba53093c5fc6c09925210dd.zip gcc-8dc63166e0b859546ba53093c5fc6c09925210dd.tar.gz gcc-8dc63166e0b859546ba53093c5fc6c09925210dd.tar.bz2 |
arith.c (gfc_convert_integer, [...]): Move to ...
2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org>
* arith.c (gfc_convert_integer, gfc_convert_real, gfc_convert_complex):
Move to ...
* primary.c (convert_integer, convert_real, convert_complex): ... here.
Rename and make static functions.
(match_integer_constant): Use convert_integer
(match_real_constant): Use convert_real.
(match_complex_constant: Use convert_complex.
* arith.h (gfc_convert_integer, gfc_convert_real, gfc_convert_complex):
Remove prototypes.
* array.c (match_array_cons_element): A BOZ cannot be a data
statement value. Jump to a common exit point.
* check.c (gfc_invalid_boz): New function. Emit error or warning
for a BOZ in an invalid context.
(boz_args_check): Move to top of file to prevent need of forward
declaration.
(is_boz_constant): New function. Check that BOZ expr is constant.
(gfc_b z2real): New function. In-place conversion of BOZ literal
constant to REAL in accordance to F2018.
(gfc_boz2int): New function. In-place conversion of BOZ literal
onstant to INTEGER in accordance to F2018.
(gfc_check_achar, gfc_check_char, gfc_check_float): Use gfc_invalid_boz.
Convert BOZ as needed.
(gfc_check_bge_bgt_ble_blt): Enforce F2018 requirements on BGE,
BGT, BLE, and BLT intrinsic functions.
(gfc_check_cmplx): Re-organize to check kind, if present, first.
Convert BOZ real and/or imaginary parts as needed in accordance to
F2018.
(gfc_check_complex): Use gfc_invalid_boz. Convert BOZ as needed.
(gfc_check_dcmplx, gfc_check_dble ): Convert BOZ as needed.
(gfc_check_dshift): Make dshift[lr] conform to F2018 standard.
gfc_check_float (gfc_expr *a)
(gfc_check_iand_ieor_ior): Make IAND, IEOR, and IOR conform to
F2018 standard.
(gfc_check_int): Conform to F2018 standard.
(gfc_check_intconv): Deprecate SHORT and LONG aliases for INT2 and
INT. Simply return for a BOZ argument. See gfc_simplify_intconv.
(gfc_check_merge_bits): Make MERGE_BITS conform to Fortran 2018
standard.
(gfc_check_real): Remove incorrect comment. Check kind, if present,
first. Simply return for a BOZ argument. See gfc_simplify_real.
(gfc_check_and): Re-do error handling for BOZ arguments. Remove
special casing ts.type != BT_INTEGER or BT_LOGICAL.
* decl.c (match_old_style_init): Check for BOZ in old-style
initialization. Issue error or warning depending on
-fallow-invalid-boz option. Issue error if variable is not an
INTEGER or REAL and the value is BOZ.
* expr.c (gfc_copy_expr): Copy a BT_BOZ gfc_expr.
(gfc_check_assign): Re-do error handling for a BOZ in an assignment
statement. Do in-place conversion of RHS based on LHS type of
INTEGER or REAL.
* gfortran.h (gfc_expr): Add a boz component. Remove is_boz component.
(gfc_boz2int, gfc_boz2real, gfc_invalid_boz): New prototypes.
* interface.c (gfc_extend_assign): Guard against replacing an
intrinsic involving a BOZ literal constant on RHS.
* invoke.texi: Doument -fallow-invalid-boz.
* lang.opt: New option. -fallow-invalid-boz.
* libgfortran.h (bt): Elevate BOZ to a basic type.
* misc.c (gfc_basic_typename, gfc_typename): Translate BT_BOZ to BOZ.
* primary.c (convert_integer, convert_real, convert_complex): to here.
Rename and make static functions.
* primary.c(match_boz_constant): Rewrite parsing of a BOZ. Re-do
error handling. Deprecate 'X' for hexidecimal and postfix notation.
Use -fallow-invalid-boz and gfc_invalid_boz to accept deprecated code.
* resolve.c (resolve_ordinary_assign): Rework a RHS that is a
BOZ literal constant. Use gfc_invalid_boz to allow previous
nonstandard behavior. Remove range checking of BOZ conversion.
* simplify.c (convert_boz): Remove function.
(simplify_cmplx): Remove conversion of BOZ constants, because
conversion is done in gfc_check_cmplx.
(gfc_simplify_float): Remove conversion of BOZ constant, because
conversion is done in gfc_check_float.
(simplify_intconv): Use gfc_boz2int to convert BOZ to INTEGER.
Remove range checking for BOZ conversion.
(gfc_simplify_real): Use k, if present, to determine kind. Convert
BOZ to REAL. Remove range checking for BOZ conversion.
target-memory.c (gfc_convert_boz): Rewrite to deal with convert of
a BOZ to a REAL value.
2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/achar_5.f90: Fix for new BOZ handling.
* arithmetic_overflow_1.f90: Ditto.
* gfortran.dg/boz_11.f90: Ditto.
* gfortran.dg/boz_12.f90: Ditto.
* gfortran.dg/boz_4.f90: Ditto.
* gfortran.dg/boz_5.f90: Ditto.
* gfortran.dg/boz_6.f90: Ditto.
* gfortran.dg/boz_7.f90: Ditto.
* gfortran.dg/boz_8.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dshift_3.f90: Ditto.
* gfortran.dg/gnu_logical_2.f90: Ditto.
* gfortran.dg/int_conv_1.f90: Ditto.
* gfortran.dg/ishft_1.f90: Ditto.
* gfortran.dg/nan_4.f90: Ditto.
* gfortran.dg/no_range_check_3.f90: Ditto.
* gfortran.dg/pr16433.f: Ditto.
* gfortran.dg/pr44491.f90: Ditto.
* gfortran.dg/pr58027.f90: Ditto.
* gfortran.dg/pr81509_2.f90: Ditto.
* gfortran.dg/unf_io_convert_1.f90: Ditto.
* gfortran.dg/unf_io_convert_2.f90: Ditto.
* gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90:
Ditto.
* gfortran.fortran-torture/execute/intrinsic_mvbits.f90: Ditto.
* gfortran.fortran-torture/execute/intrinsic_nearest.f90: Ditto.
* gfortran.fortran-torture/execute/seq_io.f90: Ditto.
* gfortran.dg/gnu_logical_1.F: Delete test.
* gfortran.dg/merge_bits_3.f90: New test.
* gfortran.dg/merge_bits_3.f90: Ditto.
* gfortran.dg/boz_int.f90: Ditto.
* gfortran.dg/boz_bge.f90: Ditto.
* gfortran.dg/boz_complex_1.f90: Ditto.
* gfortran.dg/boz_complex_2.f90: Ditto.
* gfortran.dg/boz_complex_3.f90: Ditto.
* gfortran.dg/boz_dble.f90: Ditto.
* gfortran.dg/boz_dshift_1.f90: Ditto.
* gfortran.dg/boz_dshift_2.f90: Ditto.
* gfortran.dg/boz_float_1.f90: Ditto.
* gfortran.dg/boz_float_2.f90: Ditto.
* gfortran.dg/boz_float_3.f90: Ditto.
* gfortran.dg/boz_iand_1.f90: Ditto.
* gfortran.dg/boz_iand_2.f90: Ditto.
2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org>
* testsuite/libgomp.fortran/reduction4.f90: Update BOZ usage
* testsuite/libgomp.fortran/reduction5.f90: Ditto.
From-SVN: r273747
Diffstat (limited to 'gcc/testsuite')
46 files changed, 324 insertions, 235 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14fe6b9..43e7862 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,52 @@ +2019-07-23 Steven G. Kargl <kargl@gcc.gnu.org> + + * gfortran.dg/achar_5.f90: Fix for new BOZ handling. + * arithmetic_overflow_1.f90: Ditto. + * gfortran.dg/boz_11.f90: Ditto. + * gfortran.dg/boz_12.f90: Ditto. + * gfortran.dg/boz_4.f90: Ditto. + * gfortran.dg/boz_5.f90: Ditto. + * gfortran.dg/boz_6.f90: Ditto. + * gfortran.dg/boz_7.f90: Ditto. + * gfortran.dg/boz_8.f90: Ditto. + * gfortran.dg/dec_structure_6.f90: Ditto. + * gfortran.dg/dec_union_1.f90: Ditto. + * gfortran.dg/dec_union_2.f90: Ditto. + * gfortran.dg/dec_union_5.f90: Ditto. + * gfortran.dg/dshift_3.f90: Ditto. + * gfortran.dg/gnu_logical_2.f90: Ditto. + * gfortran.dg/int_conv_1.f90: Ditto. + * gfortran.dg/ishft_1.f90: Ditto. + * gfortran.dg/nan_4.f90: Ditto. + * gfortran.dg/no_range_check_3.f90: Ditto. + * gfortran.dg/pr16433.f: Ditto. + * gfortran.dg/pr44491.f90: Ditto. + * gfortran.dg/pr58027.f90: Ditto. + * gfortran.dg/pr81509_2.f90: Ditto. + * gfortran.dg/unf_io_convert_1.f90: Ditto. + * gfortran.dg/unf_io_convert_2.f90: Ditto. + * gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90: + Ditto. + * gfortran.fortran-torture/execute/intrinsic_mvbits.f90: Ditto. + * gfortran.fortran-torture/execute/intrinsic_nearest.f90: Ditto. + * gfortran.fortran-torture/execute/seq_io.f90: Ditto. + * gfortran.dg/gnu_logical_1.F: Delete test. + * gfortran.dg/merge_bits_3.f90: New test. + * gfortran.dg/merge_bits_3.f90: Ditto. + * gfortran.dg/boz_int.f90: Ditto. + * gfortran.dg/boz_bge.f90: Ditto. + * gfortran.dg/boz_complex_1.f90: Ditto. + * gfortran.dg/boz_complex_2.f90: Ditto. + * gfortran.dg/boz_complex_3.f90: Ditto. + * gfortran.dg/boz_dble.f90: Ditto. + * gfortran.dg/boz_dshift_1.f90: Ditto. + * gfortran.dg/boz_dshift_2.f90: Ditto. + * gfortran.dg/boz_float_1.f90: Ditto. + * gfortran.dg/boz_float_2.f90: Ditto. + * gfortran.dg/boz_float_3.f90: Ditto. + * gfortran.dg/boz_iand_1.f90: Ditto. + * gfortran.dg/boz_iand_2.f90: Ditto. + 2019-07-23 Jeff Law <law@redhat.com> PR tree-optimization/86061 diff --git a/gcc/testsuite/gfortran.dg/achar_5.f90 b/gcc/testsuite/gfortran.dg/achar_5.f90 index c4f78c0..498c6e3 100644 --- a/gcc/testsuite/gfortran.dg/achar_5.f90 +++ b/gcc/testsuite/gfortran.dg/achar_5.f90 @@ -37,9 +37,4 @@ program test print *, char(huge(0_8),kind=4) ! { dg-error "too large for the collating sequence" } print *, achar(huge(0_8),kind=4) ! { dg-error "too large for the collating sequence" } - print *, char(z'FFFFFFFF', kind=4) - print *, achar(z'FFFFFFFF', kind=4) - print *, char(z'100000000', kind=4) ! { dg-error "too large for the collating sequence" } - print *, achar(z'100000000', kind=4) ! { dg-error "too large for the collating sequence" } - end program test diff --git a/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 b/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 index b19844f..95b15a8 100644 --- a/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 +++ b/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 @@ -3,8 +3,10 @@ ! ! Contributed by Tobias Burnus <burnus@gcc.gnu.org> ! +! In F2008 and F2018, overflow cannot happen, but a BOZ cannot appear +! in an array constructor. +! program bug implicit none - integer(1) :: a(2) = (/ Z'FF', Z'FF' /) ! { dg-error "Arithmetic overflow" } - print*, a + integer(1) :: a(2) = (/ Z'FF', Z'FF' /) ! { dg-error "cannot appear in" } end program bug diff --git a/gcc/testsuite/gfortran.dg/boz_11.f90 b/gcc/testsuite/gfortran.dg/boz_11.f90 index 751dc23..c9bae41 100644 --- a/gcc/testsuite/gfortran.dg/boz_11.f90 +++ b/gcc/testsuite/gfortran.dg/boz_11.f90 @@ -12,16 +12,5 @@ program test0 if (cmplx(b'01000000001010010101001111111101',x,4) /= r) STOP 1 if (cmplx(x,b'01000000001010010101001111111101',4) /= z) STOP 2 - if (complex(b'01000000001010010101001111111101',0) /= r) STOP 3 - if (complex(0,b'01000000001010010101001111111101') /= z) STOP 4 - - !if (cmplx(b'00000000000000000000000000000000& - ! &01000000001010010101001111111101',x,8) /= rd) STOP 5 - !if (cmplx(x,b'00000000000000000000000000000000& - ! &01000000001010010101001111111101',8) /= zd) STOP 6 - !if (dcmplx(b'00000000000000000000000000000000& - ! &01000000001010010101001111111101',x) /= rd) STOP 7 - !if (dcmplx(x,b'00000000000000000000000000000000& - ! &01000000001010010101001111111101') /= zd) STOP 8 end program test0 diff --git a/gcc/testsuite/gfortran.dg/boz_12.f90 b/gcc/testsuite/gfortran.dg/boz_12.f90 index 4c5c750..60a8952 100644 --- a/gcc/testsuite/gfortran.dg/boz_12.f90 +++ b/gcc/testsuite/gfortran.dg/boz_12.f90 @@ -4,11 +4,8 @@ program test implicit none real x4 double precision x8 - x4 = 1.7 x8 = 1.7 - write(*,*) complex(x4,z'1FFFFFFFF') ! { dg-error "too" } - write(*,*) cmplx(x8,z'1FFFFFFFFFFFFFFFF') ! { dg-error "too" } - write(*,*) complex(x8,z'1FFFFFFFFFFFFFFFF') ! { dg-error "too" } - write(*,*) dcmplx(x8,z'1FFFFFFFFFFFFFFFF') ! { dg-error "too" } + write(*,*) cmplx(x8,z'1FFFFFFFFFFFFFFFF') + write(*,*) dcmplx(x8,z'1FFFFFFFFFFFFFFFF') end program test diff --git a/gcc/testsuite/gfortran.dg/boz_4.f90 b/gcc/testsuite/gfortran.dg/boz_4.f90 index d016df2..35113b7 100644 --- a/gcc/testsuite/gfortran.dg/boz_4.f90 +++ b/gcc/testsuite/gfortran.dg/boz_4.f90 @@ -1,29 +1,20 @@ ! { dg-do compile } ! Test that the conversion of a BOZ constant that is too large for the ! integer variable is caught by the compiler. +! +! In F2008 and F2018, overflow cannot happen. +! program boz - implicit none - - integer(1), parameter :: & - & b1 = b'0101010110101010' ! { dg-error "overflow converting" } - integer(2), parameter :: & - & b2 = b'01110000111100001111000011110000' ! { dg-error "overflow converting" } + integer(1), parameter :: b1 = b'0101010110101010' + integer(2), parameter :: b2 = b'01110000111100001111000011110000' integer(4), parameter :: & - & b4 = b'0111000011110000111100001111000011110000111100001111000011110000' ! { dg-error "overflow converting" } - - integer(1), parameter :: & - & o1 = o'1234567076543210' ! { dg-error "overflow converting" } - integer(2), parameter :: & - & o2 = o'1234567076543210' ! { dg-error "overflow converting" } - integer(4), parameter :: & - & o4 = o'1234567076543210' ! { dg-error "overflow converting" } - - integer(1), parameter :: & - & z1 = z'deadbeef' ! { dg-error "overflow converting" } - integer(2), parameter :: & - & z2 = z'deadbeef' ! { dg-error "overflow converting" } - integer(4), parameter :: & - & z4 = z'deadbeeffeed' ! { dg-error "overflow converting" } - + & b4 = b'0111000011110000111100001111000011110000111100001111000011110000' + integer(1), parameter :: o1 = o'1234567076543210' + integer(2), parameter :: o2 = o'1234567076543210' + integer(4), parameter :: o4 = o'1234567076543210' + integer(1), parameter :: z1 = z'deadbeef' + integer(2), parameter :: z2 = z'deadbeef' + integer(4), parameter :: z4 = z'deadbeeffeed' end program boz +! { dg-prune-output "BOZ literal at" } diff --git a/gcc/testsuite/gfortran.dg/boz_5.f90 b/gcc/testsuite/gfortran.dg/boz_5.f90 index 3b1994b..f4176b9 100644 --- a/gcc/testsuite/gfortran.dg/boz_5.f90 +++ b/gcc/testsuite/gfortran.dg/boz_5.f90 @@ -1,4 +1,4 @@ ! { dg-do compile } integer, dimension (2) :: i - i = (/Z'abcde', Z'abcde/) ! { dg-error "Illegal character" } + i = (/Z'abcde', Z'abcde/) ! { dg-error "cannot appear in" } end diff --git a/gcc/testsuite/gfortran.dg/boz_6.f90 b/gcc/testsuite/gfortran.dg/boz_6.f90 index 379a44f..57a8beb 100644 --- a/gcc/testsuite/gfortran.dg/boz_6.f90 +++ b/gcc/testsuite/gfortran.dg/boz_6.f90 @@ -1,13 +1,13 @@ ! { dg-do run } -! { dg-options "-std=gnu" } +! { dg-options "-std=gnu -fallow-invalid-boz" } ! PR 24917 program test integer ib, io, iz, ix integer jb, jo, jz, jx - data ib, jb /b'111', '111'b/ - data io, jo /o'234', '234'o/ - data iz, jz /z'abc', 'abc'z/ - data ix, jx /x'abc', 'abc'x/ + data ib, jb /b'111', '111'b/ ! { dg-warning "nonstandard" } + data io, jo /o'234', '234'o/ ! { dg-warning "nonstandard" } + data iz, jz /z'abc', 'abc'z/ ! { dg-warning "nonstandard" } + data ix, jx /x'abc', 'abc'x/ ! { dg-warning "nonstandard" } if (ib /= jb) STOP 1 if (io /= jo) STOP 2 if (iz /= jz) STOP 3 diff --git a/gcc/testsuite/gfortran.dg/boz_7.f90 b/gcc/testsuite/gfortran.dg/boz_7.f90 index 348f561..45fa7a7 100644 --- a/gcc/testsuite/gfortran.dg/boz_7.f90 +++ b/gcc/testsuite/gfortran.dg/boz_7.f90 @@ -7,6 +7,6 @@ ! integer :: k, m integer :: j = z'000abc' ! { dg-error "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" } +data k/x'0003'/ ! { dg-error "nonstandard syntax" } +data m/'0003'z/ ! { dg-error "nonstandard postfix" } end diff --git a/gcc/testsuite/gfortran.dg/boz_8.f90 b/gcc/testsuite/gfortran.dg/boz_8.f90 index effce2d..0f47c67 100644 --- a/gcc/testsuite/gfortran.dg/boz_8.f90 +++ b/gcc/testsuite/gfortran.dg/boz_8.f90 @@ -11,7 +11,7 @@ real :: r integer :: i data i/z'111'/, r/z'4455'/ ! { dg-error "BOZ literal at .1. used to initialize non-integer variable 'r'" } -r = z'FFFF' ! { dg-error "outside a DATA statement" } -i = z'4455' ! { dg-error "outside a DATA statement" } -r = real(z'FFFFFFFFF') ! { dg-error "is too large" } +r = z'FFFF' ! { dg-error "a DATA statement value" } +i = z'4455' ! { dg-error "a DATA statement value" } +r = real(z'FFFFFFFFF') end diff --git a/gcc/testsuite/gfortran.dg/boz_bge.f90 b/gcc/testsuite/gfortran.dg/boz_bge.f90 new file mode 100644 index 0000000..46891e3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_bge.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +program foo + + integer :: k = 4242 + + if (bge(z'1234', z'5678') .neqv. .false.) stop 1 + if (bgt(z'1234', z'5678') .neqv. .false.) stop 2 + if (ble(z'1234', z'5678') .eqv. .false.) stop 3 + if (blt(z'1234', z'5678') .eqv. .false.) stop 4 + + if (bge(z'1234', k) .eqv. .false.) stop 5 + if (bgt(z'1234', k) .eqv. .false.) stop 6 + if (ble(z'1234', k) .neqv. .false.) stop 7 + if (blt(z'1234', k) .neqv. .false.) stop 8 + + if (bge(k, z'5678') .neqv. .false.) stop 9 + if (bgt(k, z'5678') .neqv. .false.) stop 10 + if (ble(k, z'5678') .eqv. .false.) stop 11 + if (blt(k, z'5678') .eqv. .false.) stop 12 + +end program foo + diff --git a/gcc/testsuite/gfortran.dg/boz_complex_1.f90 b/gcc/testsuite/gfortran.dg/boz_complex_1.f90 new file mode 100644 index 0000000..e05246a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_complex_1.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +program foo + + implicit none + + complex(4) z + + z = complex(z'4444', z'4444') ! { dg-error "cannot both be BOZ" } + if (real(z,4) /= 17476.0 .or. aimag(z) /= 42.0) stop 2 + + z = complex(z'4444', 42) ! { dg-error "cannot appear in the" } + if (real(z,4) /= 17476.0 .or. aimag(z) /= 42.0) stop 2 + + z = complex(z'44444400', 42.) ! { dg-error "cannot appear in the" } + if (real(z,4) /= 785.062500 .or. aimag(z) /= 42.0) stop 3 + +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_complex_2.f90 b/gcc/testsuite/gfortran.dg/boz_complex_2.f90 new file mode 100644 index 0000000..345027b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_complex_2.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fallow-invalid-boz" } +program foo + + implicit none + + complex(4) z + + z = complex(z'4444', 42) ! { dg-warning "cannot appear in the" } + if (real(z,4) /= 17476.0 .or. aimag(z) /= 42.0) stop 2 + + z = complex(z'44444400', 42.) ! { dg-warning "cannot appear in the" } + if (real(z,4) /= 785.062500 .or. aimag(z) /= 42.0) stop 3 + +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_complex_3.f90 b/gcc/testsuite/gfortran.dg/boz_complex_3.f90 new file mode 100644 index 0000000..4318a7f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_complex_3.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! { dg-options "-fallow-invalid-boz -w" } +program foo + + implicit none + + complex(4) z + + z = complex(z'4444', 42) + if (real(z,4) /= 17476.0 .or. aimag(z) /= 42.0) stop 2 + + z = complex(z'44444400', 42.) + if (real(z,4) /= 785.062500 .or. aimag(z) /= 42.0) stop 3 + +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_dble.f90 b/gcc/testsuite/gfortran.dg/boz_dble.f90 new file mode 100644 index 0000000..c155243 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_dble.f90 @@ -0,0 +1,6 @@ +! { dg-do run } +program foo + double precision x + x = dble(z"400921FB54411744"); + if (x /= 3.1415926535_8) stop 1 +end diff --git a/gcc/testsuite/gfortran.dg/boz_dshift_1.f90 b/gcc/testsuite/gfortran.dg/boz_dshift_1.f90 new file mode 100644 index 0000000..ba10315 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_dshift_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +program foo + integer k, n + k = dshiftl(z'1234',z'2345',1) ! { dg-error "cannot both be BOZ" } + n = dshiftr(z'1234',z'2345',1) ! { dg-error "cannot both be BOZ" } + if (k .eq. n) stop 1 + k = dshiftl(z'1234',3.1415,1) ! { dg-error "must be INTEGER" } + n = dshiftr(2.7362,z'2345',1) ! { dg-error "must be INTEGER" } + if (k .eq. n) stop 2 +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_dshift_2.f90 b/gcc/testsuite/gfortran.dg/boz_dshift_2.f90 new file mode 100644 index 0000000..c2fbd1b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_dshift_2.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +program foo + integer k, n + k = dshiftl(z'1234',42,1) + n = dshiftr(z'1234',42,1) + if (k /= 9320) stop 1 + if (n /= 21) stop 2 + k = dshiftl(42,b'01010101', 1) + n = dshiftr(22,o'12345', 1) + if (k /= 84) stop 1 + if (n /= 2674) stop 2 +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_float_1.f90 b/gcc/testsuite/gfortran.dg/boz_float_1.f90 new file mode 100644 index 0000000..e444b09 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_float_1.f90 @@ -0,0 +1,4 @@ +! { dg-do compile } +program foo + print *, float(z'1234') ! { dg-error "cannot appear in" } +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_float_2.f90 b/gcc/testsuite/gfortran.dg/boz_float_2.f90 new file mode 100644 index 0000000..638dae2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_float_2.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +! { dg-options "-fallow-invalid-boz" } +program foo + print *, float(z'1234') ! { dg-warning "cannot appear in" } +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_float_3.f90 b/gcc/testsuite/gfortran.dg/boz_float_3.f90 new file mode 100644 index 0000000..7262495 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_float_3.f90 @@ -0,0 +1,7 @@ +! { dg-do run } +! { dg-options "-fallow-invalid-boz -w" } +program foo + integer i + i = float(z'1234') + if (i /= 4660.0) stop 1 +end program foo diff --git a/gcc/testsuite/gfortran.dg/boz_iand_1.f90 b/gcc/testsuite/gfortran.dg/boz_iand_1.f90 new file mode 100644 index 0000000..45d8c39 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_iand_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +program foo + print *, iand(z'1234', z'3456') ! { dg-error "cannot both be" } + print *, and(z'1234', z'3456') ! { dg-error "cannot both be" } + print *, ieor(z'1234', z'3456') ! { dg-error "cannot both be" } + print *, xor(z'1234', z'3456') ! { dg-error "cannot both be" } + print *, ior(z'1234', z'3456') ! { dg-error "cannot both be" } + print *, or(z'1234', z'3456') ! { dg-error "cannot both be" } +end program foo + diff --git a/gcc/testsuite/gfortran.dg/boz_iand_2.f90 b/gcc/testsuite/gfortran.dg/boz_iand_2.f90 new file mode 100644 index 0000000..e656ac0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_iand_2.f90 @@ -0,0 +1,17 @@ +! { dg-do run } +program foo + integer :: k = 42 + n = iand(k, z'3456'); if (n /= 2) stop 1 + n = iand(z'1234', k); if (n /= 32) stop 2 + n = and(k, z'3456'); if (n /= 2) stop 3 + n = and(z'1234', k); if (n /= 32) stop 4 + n = ieor(k, z'3456'); if (n /= 13436) stop 5 + n = ieor(z'1234', k); if (n /= 4638) stop 6 + n = xor(k, z'3456'); if (n /= 13436) stop 7 + n = xor(z'1234', k); if (n /= 4638) stop 8 + n = ior(k, z'3456'); if (n /= 13438) stop 9 + n = ior(z'1234', k); if (n /= 4670) stop 10 + n = or(k, z'3456'); if (n /= 13438) stop 11 + n = or(z'1234', k); if (n /= 4670) stop 12 +end program foo + diff --git a/gcc/testsuite/gfortran.dg/boz_int.f90 b/gcc/testsuite/gfortran.dg/boz_int.f90 new file mode 100644 index 0000000..79302cd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_int.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +program foo + implicit none + integer(1) i1 + integer(2) i2 + integer(4) i4, j4 + integer(8) i8 + i1 = int(z'12', 1); if (i1 /= 18) stop 1 + i2 = int(z'1234', 2); if (i2 /= 4660) stop 2 + i4 = int(z'1234', 4); if (i4 /= 4660) stop 3 + j4 = int(z'1234'); if (i4 /= 4660) stop 4 + i8 = int(z'1233456',8); if (i8 /= 19084374_8) stop 5 +end program diff --git a/gcc/testsuite/gfortran.dg/dec_structure_6.f90 b/gcc/testsuite/gfortran.dg/dec_structure_6.f90 index 91a4df9..69ff50c 100644 --- a/gcc/testsuite/gfortran.dg/dec_structure_6.f90 +++ b/gcc/testsuite/gfortran.dg/dec_structure_6.f90 @@ -41,6 +41,6 @@ if ( r8.o(1) /= 9 .or. r8.o(2) /= 9 .or. r8.o(3) /= 9 ) call aborts ("r8.o") if ( r8.p(1,1) /= 1 .or. r8.p(2,1) /= 2 .or. r8.p(1,2) /= 3 & .or. r8.p(2,2) /= 4) & call aborts ("r8.p") -if ( r8.canary /= z'3D3D3D3D' ) call aborts ("r8.canary") +if ( r8.canary /= int(z'3D3D3D3D') ) call aborts ("r8.canary") end diff --git a/gcc/testsuite/gfortran.dg/dec_union_1.f90 b/gcc/testsuite/gfortran.dg/dec_union_1.f90 index 074782c..689628c 100644 --- a/gcc/testsuite/gfortran.dg/dec_union_1.f90 +++ b/gcc/testsuite/gfortran.dg/dec_union_1.f90 @@ -28,8 +28,8 @@ subroutine sub () end union end structure record /s6/ r6 - r6.ibuf(1) = z'badbeef' - r6.ibuf(2) = z'badbeef' + r6.ibuf(1) = int(z'badbeef') + r6.ibuf(2) = int(z'badbeef') end subroutine ! Repeat definition from subroutine sub with different size parameter. @@ -55,7 +55,7 @@ integer :: r6_canary = 0 ! Copied type declaration - this should not cause problems i = 1 do while (i < siz) - r6.ibuf(i) = z'badbeef' + r6.ibuf(i) = int(z'badbeef') i = i + 1 end do diff --git a/gcc/testsuite/gfortran.dg/dec_union_2.f90 b/gcc/testsuite/gfortran.dg/dec_union_2.f90 index 99db431..4e23955 100644 --- a/gcc/testsuite/gfortran.dg/dec_union_2.f90 +++ b/gcc/testsuite/gfortran.dg/dec_union_2.f90 @@ -31,6 +31,7 @@ structure /s1/ end map end union end structure + structure /s2/ union ! U2 map ! M4 @@ -51,9 +52,9 @@ r1.b = 1.33e7 if ( r1.a .eq. 0 ) call aborts ("basic union 1") ! Endian-agnostic runtime check -r2.long = z'12345678' -if (.not. ( (r2.w1 .eq. z'1234' .and. r2.w2 .eq. z'5678') & - .or. (r2.w1 .eq. z'5678' .and. r2.w2 .eq. z'1234')) ) then +r2.long = int(z'12345678') +if (.not. ( (r2.w1 .eq. int(z'1234',2) .and. r2.w2 .eq. int(z'5678',2)) & + .or. (r2.w1 .eq. int(z'5678',2) .and. r2.w2 .eq. int(z'1234',2))) ) then call aborts ("basic union 2") endif diff --git a/gcc/testsuite/gfortran.dg/dec_union_5.f90 b/gcc/testsuite/gfortran.dg/dec_union_5.f90 index f3cca5d..712b9a4 100644 --- a/gcc/testsuite/gfortran.dg/dec_union_5.f90 +++ b/gcc/testsuite/gfortran.dg/dec_union_5.f90 @@ -25,11 +25,11 @@ end structure record /s5/ r5 ! Unions with arrays -r5.a(1) = z'41' -r5.a(2) = z'42' -r5.a(3) = z'43' -r5.a(4) = z'44' -r5.a(5) = z'45' +r5.a(1) = int(z'41',1) +r5.a(2) = int(z'42',1) +r5.a(3) = int(z'43',1) +r5.a(4) =int( z'44',1) +r5.a(5) = int(z'45',1) if ( r5.s(1) .ne. 'A' & .or. r5.s(2) .ne. 'B' & .or. r5.s(3) .ne. 'C' & diff --git a/gcc/testsuite/gfortran.dg/dshift_3.f90 b/gcc/testsuite/gfortran.dg/dshift_3.f90 index 1f214c7..2ed2840 100644 --- a/gcc/testsuite/gfortran.dg/dshift_3.f90 +++ b/gcc/testsuite/gfortran.dg/dshift_3.f90 @@ -17,7 +17,6 @@ subroutine foo(i, j, k) print *, dshiftl(i, k, 10) ! { dg-error "must be the same type and kind" } print *, dshiftl(k, j, 10) ! { dg-error "must be the same type and kind" } print *, dshiftl(i, j, k) - print *, dshiftl(i, j, z'd') print *, dshiftr(i, j, 134) ! { dg-error "must be less than or equal" } print *, dshiftr(z'FFF', j, 134) ! { dg-error "must be less than or equal" } @@ -29,6 +28,5 @@ subroutine foo(i, j, k) print *, dshiftr(i, k, 10) ! { dg-error "must be the same type and kind" } print *, dshiftr(k, j, 10) ! { dg-error "must be the same type and kind" } print *, dshiftr(i, j, k) - print *, dshiftr(i, j, z'd') end subroutine foo diff --git a/gcc/testsuite/gfortran.dg/gnu_logical_1.F b/gcc/testsuite/gfortran.dg/gnu_logical_1.F index 19e368c..e69de29 100644 --- a/gcc/testsuite/gfortran.dg/gnu_logical_1.F +++ b/gcc/testsuite/gfortran.dg/gnu_logical_1.F @@ -1,91 +0,0 @@ -! Testcases for the AND, OR and XOR functions (GNU intrinsics). -! { dg-do run } -! { dg-options "-ffixed-line-length-none" } - integer(kind=1) i1, j1 - integer(kind=2) i2, j2 - integer i4, j4 - integer(kind=8) i8, j8 - logical(kind=1) l1, k1 - logical(kind=2) l2, k2 - logical l4, k4 - logical(kind=8) l8, k8 - -#define TEST_INTEGER(u,ukind,v,vkind) \ - ukind = u;\ - vkind = v;\ - if (iand(u,v) /= and(ukind, vkind)) STOP 1;\ - if (iand(u,v) /= and(vkind, ukind)) STOP 1;\ - if (ieor(u,v) /= xor(ukind, vkind)) STOP 1;\ - if (ieor(u,v) /= xor(vkind, ukind)) STOP 1;\ - if (ior(u,v) /= or(ukind, vkind)) STOP 1;\ - if (ior(u,v) /= or(vkind, ukind)) STOP 1 - - TEST_INTEGER(19,i1,6,j1) - TEST_INTEGER(19,i1,6,j2) - TEST_INTEGER(19,i1,6,j4) - TEST_INTEGER(19,i1,6,j8) - - TEST_INTEGER(19,i2,6,j1) - TEST_INTEGER(19,i2,6,j2) - TEST_INTEGER(19,i2,6,j4) - TEST_INTEGER(19,i2,6,j8) - - TEST_INTEGER(19,i4,6,j1) - TEST_INTEGER(19,i4,6,j2) - TEST_INTEGER(19,i4,6,j4) - TEST_INTEGER(19,i4,6,j8) - - TEST_INTEGER(19,i8,6,j1) - TEST_INTEGER(19,i8,6,j2) - TEST_INTEGER(19,i8,6,j4) - TEST_INTEGER(19,i8,6,j8) - - - -#define TEST_LOGICAL(u,ukind,v,vkind) \ - ukind = u;\ - vkind = v;\ - if ((u .and. v) .neqv. and(ukind, vkind)) STOP 1;\ - if ((u .and. v) .neqv. and(vkind, ukind)) STOP 1;\ - if (((u .and. .not. v) .or. (.not. u .and. v)) .neqv. xor(ukind, vkind)) STOP 1;\ - if (((u .and. .not. v) .or. (.not. u .and. v)) .neqv. xor(vkind, ukind)) STOP 1;\ - if ((u .or. v) .neqv. or(ukind, vkind)) STOP 1;\ - if ((u .or. v) .neqv. or(vkind, ukind)) STOP 2 - - TEST_LOGICAL(.true.,l1,.false.,k1) - TEST_LOGICAL(.true.,l1,.true.,k1) - TEST_LOGICAL(.true.,l1,.false.,k2) - TEST_LOGICAL(.true.,l1,.true.,k2) - TEST_LOGICAL(.true.,l1,.false.,k4) - TEST_LOGICAL(.true.,l1,.true.,k4) - TEST_LOGICAL(.true.,l1,.false.,k8) - TEST_LOGICAL(.true.,l1,.true.,k8) - - TEST_LOGICAL(.true.,l2,.false.,k1) - TEST_LOGICAL(.true.,l2,.true.,k1) - TEST_LOGICAL(.true.,l2,.false.,k2) - TEST_LOGICAL(.true.,l2,.true.,k2) - TEST_LOGICAL(.true.,l2,.false.,k4) - TEST_LOGICAL(.true.,l2,.true.,k4) - TEST_LOGICAL(.true.,l2,.false.,k8) - TEST_LOGICAL(.true.,l2,.true.,k8) - - TEST_LOGICAL(.true.,l4,.false.,k1) - TEST_LOGICAL(.true.,l4,.true.,k1) - TEST_LOGICAL(.true.,l4,.false.,k2) - TEST_LOGICAL(.true.,l4,.true.,k2) - TEST_LOGICAL(.true.,l4,.false.,k4) - TEST_LOGICAL(.true.,l4,.true.,k4) - TEST_LOGICAL(.true.,l4,.false.,k8) - TEST_LOGICAL(.true.,l4,.true.,k8) - - TEST_LOGICAL(.true.,l8,.false.,k1) - TEST_LOGICAL(.true.,l8,.true.,k1) - TEST_LOGICAL(.true.,l8,.false.,k2) - TEST_LOGICAL(.true.,l8,.true.,k2) - TEST_LOGICAL(.true.,l8,.false.,k4) - TEST_LOGICAL(.true.,l8,.true.,k4) - TEST_LOGICAL(.true.,l8,.false.,k8) - TEST_LOGICAL(.true.,l8,.true.,k8) - - end diff --git a/gcc/testsuite/gfortran.dg/gnu_logical_2.f90 b/gcc/testsuite/gfortran.dg/gnu_logical_2.f90 index 4ff70fa..a7b31b4 100644 --- a/gcc/testsuite/gfortran.dg/gnu_logical_2.f90 +++ b/gcc/testsuite/gfortran.dg/gnu_logical_2.f90 @@ -7,23 +7,23 @@ print *, and(i,i) print *, and(l,l) - print *, and(i,r) ! { dg-error "must be INTEGER or LOGICAL" } - print *, and(c,l) ! { dg-error "must be INTEGER or LOGICAL" } - print *, and(i,l) ! { dg-error "must have the same type" } - print *, and(l,i) ! { dg-error "must have the same type" } + print *, and(i,r) ! { dg-error "must be the same type" } + print *, and(c,l) ! { dg-error "must be the same type" } + print *, and(i,l) ! { dg-error "must be the same type" } + print *, and(l,i) ! { dg-error "must be the same type" } print *, or(i,i) print *, or(l,l) - print *, or(i,r) ! { dg-error "must be INTEGER or LOGICAL" } - print *, or(c,l) ! { dg-error "must be INTEGER or LOGICAL" } - print *, or(i,l) ! { dg-error "must have the same type" } - print *, or(l,i) ! { dg-error "must have the same type" } + print *, or(i,r) ! { dg-error "must be the same type" } + print *, or(c,l) ! { dg-error "must be the same type" } + print *, or(i,l) ! { dg-error "must be the same type" } + print *, or(l,i) ! { dg-error "must be the same type" } print *, xor(i,i) print *, xor(l,l) - print *, xor(i,r) ! { dg-error "must be INTEGER or LOGICAL" } - print *, xor(c,l) ! { dg-error "must be INTEGER or LOGICAL" } - print *, xor(i,l) ! { dg-error "must have the same type" } - print *, xor(l,i) ! { dg-error "must have the same type" } + print *, xor(i,r) ! { dg-error "must be the same type" } + print *, xor(c,l) ! { dg-error "must be the same type" } + print *, xor(i,l) ! { dg-error "must be the same type" } + print *, xor(l,i) ! { dg-error "must be the same type" } end diff --git a/gcc/testsuite/gfortran.dg/int_conv_1.f90 b/gcc/testsuite/gfortran.dg/int_conv_1.f90 index a3e8783..daf0dfd 100644 --- a/gcc/testsuite/gfortran.dg/int_conv_1.f90 +++ b/gcc/testsuite/gfortran.dg/int_conv_1.f90 @@ -1,36 +1,25 @@ ! { dg-do run } ! { dg-options "-std=gnu" } - integer(kind=2) :: i2, j2, k2, l2, m2, n2, o2 - integer(kind=4) :: i4, j4 - integer(kind=8) :: i8, j8 + integer(kind=2) :: i2, k2, l2 + integer(kind=8) :: i8 real :: x complex :: z i2 = huge(i2) / 3 i8 = int8(i2) - i4 = long(i2) - j2 = short(i2) k2 = int2(i2) l2 = int2(i8) - m2 = short(i8) - n2 = int2(i4) - o2 = short(i4) - if (i8 /= i2 .or. i4 /= i2 .or. j2 /= i2 .or. k2 /= i2 & - .or. l2 /= i2 .or. m2 /= i2 .or. n2 /= i2 .or. o2 /= i2) STOP 1 + if (i8 /= i2 .or. k2 /= i2 .or. l2 /= i2 ) STOP 1 x = i2 i8 = int8(x) - i4 = long(x) - j2 = short(x) k2 = int2(x) - if (i8 /= i2 .or. i4 /= i2 .or. j2 /= i2 .or. k2 /= i2) STOP 2 + if (i8 /= i2 .or. k2 /= i2) STOP 2 z = i2 + (0.,-42.) i8 = int8(z) - i4 = long(z) - j2 = short(z) k2 = int2(z) - if (i8 /= i2 .or. i4 /= i2 .or. j2 /= i2 .or. k2 /= i2) STOP 3 + if (i8 /= i2 .or. k2 /= i2) STOP 3 end diff --git a/gcc/testsuite/gfortran.dg/ishft_1.f90 b/gcc/testsuite/gfortran.dg/ishft_1.f90 index 82fdb02..ffac323 100644 --- a/gcc/testsuite/gfortran.dg/ishft_1.f90 +++ b/gcc/testsuite/gfortran.dg/ishft_1.f90 @@ -25,7 +25,6 @@ if (ishft (1_8, 0) /= 1) STOP 19 if (ishft (1_8, 1) /= 2) STOP 20 if (ishft (3_8, 1) /= 6) STOP 21 if (ishft (-1_8, 1) /= -2) STOP 22 -if (ishft (-1_8, -60) /= z'F') STOP 23 if (ishftc (1_1, 0) /= 1) STOP 24 if (ishftc (1_1, 1) /= 2) STOP 25 diff --git a/gcc/testsuite/gfortran.dg/merge_bits_3.f90 b/gcc/testsuite/gfortran.dg/merge_bits_3.f90 new file mode 100644 index 0000000..8193b32 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/merge_bits_3.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +program foo + integer m + m = merge_bits(b'010101', b"101010", 42) ! { dg-error "cannot both be" } +end program foo diff --git a/gcc/testsuite/gfortran.dg/merge_bits_4.f90 b/gcc/testsuite/gfortran.dg/merge_bits_4.f90 new file mode 100644 index 0000000..5622ecb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/merge_bits_4.f90 @@ -0,0 +1,7 @@ +! { dg-do run } +program foo + integer m, n, k + m = merge_bits(b'010101', 1234, 42); if (m /= 1232) stop 1 + n = merge_bits(1234, z'3456', 42); if (n /= 13398) stop 2 + k = merge_bits(1234, 3456, o'12334'); if (k /= 3536) stop 3 +end program foo diff --git a/gcc/testsuite/gfortran.dg/nan_4.f90 b/gcc/testsuite/gfortran.dg/nan_4.f90 index 46aba3e..707f9e9 100644 --- a/gcc/testsuite/gfortran.dg/nan_4.f90 +++ b/gcc/testsuite/gfortran.dg/nan_4.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } -! { dg-options "-std=gnu" } +! { dg-options "-std=gnu -fallow-invalid-boz" } ! { dg-add-options ieee } ! { dg-skip-if "NaN not supported" { spu-*-* } } ! @@ -9,8 +9,8 @@ ! program test implicit none - real(4), parameter :: r0 = z'FFFFFFFF' ! { dg-error "Arithmetic NaN" } + real(4), parameter :: r0 = z'FFFFFFFF' real(4) r - data r/z'FFFFFFFF'/ ! { dg-error "Arithmetic NaN" } - r = z'FFFFFFFF' ! { dg-error "Arithmetic NaN" } + data r/z'FFFFFFFF'/ + r = z'FFFFFFFF' ! { dg-warning "neither a DATA statement value" } end program test diff --git a/gcc/testsuite/gfortran.dg/no_range_check_3.f90 b/gcc/testsuite/gfortran.dg/no_range_check_3.f90 index ffab312..4653ff0 100644 --- a/gcc/testsuite/gfortran.dg/no_range_check_3.f90 +++ b/gcc/testsuite/gfortran.dg/no_range_check_3.f90 @@ -1,6 +1,6 @@ ! { dg-do run } -! { dg-options "-fno-range-check" } program test + integer(2) :: j, k integer :: i i = int(z'FFFFFFFF',kind(i)) if (i /= -1) STOP 1 @@ -9,4 +9,8 @@ program test if (popcnt(int(z'0F00F00080000001',8)) /= 10) STOP 3 if (popcnt(int(z'800F0001',4)) /= 6) STOP 4 + j = -1234_2 + k = int(z'FB2E',kind(j)) + if (k /= j) STOP 5 + if (int(z'FB2E',kind(j)) /= j) STOP 6 end program test diff --git a/gcc/testsuite/gfortran.dg/pr16433.f b/gcc/testsuite/gfortran.dg/pr16433.f index cb3dcec..925eb52 100644 --- a/gcc/testsuite/gfortran.dg/pr16433.f +++ b/gcc/testsuite/gfortran.dg/pr16433.f @@ -1,6 +1,6 @@ ! { dg-do compile } real x double precision dx - data x/x'2ffde'/ ! { dg-warning "Hexadecimal constant | used to initialize non-integer" } - dx = x ! { dg-bogus "exadecimal constant" "Hex constant where there is none" } + data x/x'2ffde'/ ! { dg-error "Hexadecimal constant" } + dx = x end diff --git a/gcc/testsuite/gfortran.dg/pr44491.f90 b/gcc/testsuite/gfortran.dg/pr44491.f90 index 406bb26..3bd31c4 100644 --- a/gcc/testsuite/gfortran.dg/pr44491.f90 +++ b/gcc/testsuite/gfortran.dg/pr44491.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } ! { dg-options "-std=gnu" } ! PR fortran/44491 - character*2 escape /z'1B'/ ! { dg-error "Incompatible types in DATA" } + character*2 escape /z'1B'/ ! { dg-error "cannot appear in" } end diff --git a/gcc/testsuite/gfortran.dg/pr58027.f90 b/gcc/testsuite/gfortran.dg/pr58027.f90 index bef893c..7398c6c 100644 --- a/gcc/testsuite/gfortran.dg/pr58027.f90 +++ b/gcc/testsuite/gfortran.dg/pr58027.f90 @@ -1,5 +1,5 @@ ! { dg-do compile } ! PR fortran/58027 -integer, parameter :: i(1)=(/z'ff800000'/) ! { dg-error "overflow converting" } +integer, parameter :: i(1)=(/z'ff800000'/) ! { dg-error "cannot appear in" } print *, isclass end diff --git a/gcc/testsuite/gfortran.dg/pr81509_2.f90 b/gcc/testsuite/gfortran.dg/pr81509_2.f90 index 919cb4e..a0618cc 100644 --- a/gcc/testsuite/gfortran.dg/pr81509_2.f90 +++ b/gcc/testsuite/gfortran.dg/pr81509_2.f90 @@ -12,7 +12,7 @@ k = and(i, z'1234') k = ieor(z'ade',i) k = ior(i,z'1111') k = ior(i,k) ! { dg-error "different kind type parameters" } -k = and(i,k) -k = and(a,z'1234') ! { dg-error "must have the same type" } +k = and(i,k) ! { dg-error "must be the same type" } +k = and(a,z'1234') ! { dg-error "must be the same type" } end program foo diff --git a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 index 1baa7f5..61d982d 100644 --- a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 +++ b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 @@ -18,9 +18,9 @@ program main integer i character(4) str - m(1) = Z'11223344' ! { dg-warning "BOZ literal at .1. outside a DATA statement" } - m(2) = Z'55667788' ! { dg-warning "BOZ literal at .1. outside a DATA statement" } - n = Z'77AABBCC' ! { dg-warning "BOZ literal at .1. outside a DATA statement" } + m(1) = int(Z'11223344') + m(2) = int(Z'55667788') + n = int(Z'77AABBCC') 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.int(Z'11223344')) then 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.int(Z'55667788')) then 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.int(Z'77AABBCC')) then if (debug) then print '(A,Z8)','n incorrect. n = ',n else diff --git a/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 b/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 index e9092cb..cc5ab4d 100644 --- a/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 +++ b/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 @@ -15,26 +15,28 @@ program main close(10,status="delete") open (10, form="unformatted",convert="big_endian") ! { dg-warning "Extension: CONVERT" } - i = (/ Z'11223344', Z'55667700' /) + i = (/ int(Z'11223344'), int(Z'55667700') /) 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 /= (/ int(Z'11',1), int(Z'22',1), int(Z'33',1), int(Z'44',1), & + & int(Z'55',1), int(Z'66',1), int(Z'77',1), int(Z'00',1) /))) & STOP 2 backspace 10 read (10) j - if (j /= Z'1122334455667700') STOP 3 + if (j /= int(Z'1122334455667700',8)) STOP 3 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 /= (/ int(Z'44',1), int(Z'33',1), int(Z'22',1), int(Z'11',1), & + & int(Z'00',1), int(Z'77',1), int(Z'66',1), int(Z'55',1) /))) & STOP 4 backspace 10 read (10) j - if (j /= Z'5566770011223344') STOP 5 + if (j /= int(Z'5566770011223344',8)) STOP 5 close (10, status="delete") end program main diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 index ed7e2f1..ce7f0fb 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90 @@ -13,25 +13,25 @@ program test_exponent_fraction x = 0. call test_4(x) - i = o'00000000001' + i = int(o'00000000001') call test_4(x) - i = o'00010000000' + i = int(o'00010000000') call test_4(x) - i = o'17700000000' + i = int(o'17700000000') call test_4(x) - i = o'00004000001' + i = int(o'00004000001') call test_4(x) - i = o'17737777777' + i = int(o'17737777777') call test_4(x) - i = o'10000000000' + i = int(o'10000000000') call test_4(x) - i = o'0000010000' + i = int(o'0000010000') call test_4(x) y = 0.5 @@ -40,7 +40,7 @@ program test_exponent_fraction y = 0. call test_8(y) - j = o'00000000001' + j = int(o'00000000001',8) call test_8(y) y = 0.2938735877D-38 @@ -49,7 +49,7 @@ program test_exponent_fraction y = -1.469369D-39 call test_8(y) - y = z'7fe00000' + y = real(z'7fe00000',8) call test_8(y) y = -5.739719D+42 diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 index c423d4f..13ff85e 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mvbits.f90 @@ -10,7 +10,7 @@ CALL mvbits(from, 2, 16, to, 1) if (to /= result) STOP 1 to8 = 0_8 -from8 = b'1011'*2_8**32 +from8 = int(b'1011',8)*2_8**32 call mvbits (from8, 33, 3, to8, 2) -if (to8 /= b'10100') STOP 1 +if (to8 /= int(b'10100',8)) STOP 1 end diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.f90 index ec2bc18..222da0a 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_nearest.f90 @@ -11,13 +11,13 @@ program test_nearest s = 3.0 call test_n (s, r) - i = z'00800000' + i = int(z'00800000') call test_n (s, r) - i = z'007fffff' + i = int(z'007fffff') call test_n (s, r) - i = z'00800100' + i = int(z'00800100') call test_n (s, r) s = 0 @@ -25,9 +25,8 @@ program test_nearest y = nearest(s, -r) if (.not. (x .gt. s .and. y .lt. s )) STOP 1 -! ??? This is pretty sketchy, but passes on most targets. - infi = z'7f800000' - maxi = z'7f7fffff' + infi = int(z'7f800000') + maxi = int(z'7f7fffff') call test_up(max, inf) call test_up(-inf, -max) diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 index dadab92..54f2aa7 100644 --- a/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/execute/seq_io.f90 @@ -16,9 +16,9 @@ integer n real*4 r(size) integer i - m(1) = Z'11111111' - m(2) = Z'22222222' - n = Z'33333333' + m(1) = int(Z'11111111') + m(2) = int(Z'22222222') + n = int(Z'33333333') do i = 1,size r(i) = i end do @@ -39,7 +39,7 @@ read(9)r ! ! check results - if (m(1).ne.Z'11111111') then + if (m(1).ne. int(Z'11111111')) then if (debug) then print '(A,Z8)','m(1) incorrect. m(1) = ',m(1) else @@ -47,7 +47,7 @@ endif endif - if (m(2).ne.Z'22222222') then + if (m(2).ne. int(Z'22222222')) then if (debug) then print '(A,Z8)','m(2) incorrect. m(2) = ',m(2) else @@ -55,7 +55,7 @@ endif endif - if (n.ne.Z'33333333') then + if (n.ne. int(Z'33333333')) then if (debug) then print '(A,Z8)','n incorrect. n = ',n else |