re PR libfortran/26735 ([4.1 only] -fconvert=swap and implied open)
2006-03-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/26735 * io/transfer.c (data_transfer_init): Set u_flags.convert on an unopened unit if specified by environment variable (via get_unformatted_convert) or by compile-time option. 2006-03-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/26735 * gfortran.dg/convert_implied_open.f90: New test case. From-SVN: r112382
This commit is contained in:
parent
9a0fb43ea1
commit
5068c62534
|
@ -1,3 +1,8 @@
|
|||
2006-03-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR libfortran/26735
|
||||
* gfortran.dg/convert_implied_open.f90: New test case.
|
||||
|
||||
2006-03-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR fortran/26769
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
! { dg-do run }
|
||||
! { dg-options "-fconvert=swap" }
|
||||
! PR 26735 - implied open didn't use to honor -fconvert
|
||||
program main
|
||||
implicit none
|
||||
integer (kind=8) :: i1, i2, i3
|
||||
write (10) 1_8
|
||||
close (10)
|
||||
open (10, form="unformatted", access="direct", recl=8)
|
||||
read (10,rec=1) i1
|
||||
read (10,rec=2) i2
|
||||
read (10,rec=3) i3
|
||||
if (i1 /= 8 .or. i2 /= 1 .or. i3 /= 8) call abort
|
||||
close (10,status="delete")
|
||||
end program main
|
|
@ -1,3 +1,10 @@
|
|||
2006-03-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR libfortran/26735
|
||||
* io/transfer.c (data_transfer_init): Set u_flags.convert
|
||||
on an unopened unit if specified by environment variable
|
||||
(via get_unformatted_convert) or by compile-time option.
|
||||
|
||||
2006-03-25 Thomas Koenig <Thomas.Koenig@online.de>
|
||||
|
||||
PR fortran/26769
|
||||
|
|
|
@ -1390,6 +1390,8 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
|
|||
if (dtp->u.p.current_unit->s == NULL)
|
||||
{ /* Open the unit with some default flags. */
|
||||
st_parameter_open opp;
|
||||
unit_convert conv;
|
||||
|
||||
if (dtp->common.unit < 0)
|
||||
{
|
||||
close_unit (dtp->u.p.current_unit);
|
||||
|
@ -1413,6 +1415,35 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
|
|||
u_flags.blank = BLANK_UNSPECIFIED;
|
||||
u_flags.pad = PAD_UNSPECIFIED;
|
||||
u_flags.status = STATUS_UNKNOWN;
|
||||
|
||||
conv = get_unformatted_convert (dtp->common.unit);
|
||||
|
||||
if (conv == CONVERT_NONE)
|
||||
conv = compile_options.convert;
|
||||
|
||||
/* We use l8_to_l4_offset, which is 0 on little-endian machines
|
||||
and 1 on big-endian machines. */
|
||||
switch (conv)
|
||||
{
|
||||
case CONVERT_NATIVE:
|
||||
case CONVERT_SWAP:
|
||||
break;
|
||||
|
||||
case CONVERT_BIG:
|
||||
conv = l8_to_l4_offset ? CONVERT_NATIVE : CONVERT_SWAP;
|
||||
break;
|
||||
|
||||
case CONVERT_LITTLE:
|
||||
conv = l8_to_l4_offset ? CONVERT_SWAP : CONVERT_NATIVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
internal_error (&opp.common, "Illegal value for CONVERT");
|
||||
break;
|
||||
}
|
||||
|
||||
u_flags.convert = conv;
|
||||
|
||||
opp.common = dtp->common;
|
||||
opp.common.flags &= IOPARM_COMMON_MASK;
|
||||
dtp->u.p.current_unit = new_unit (&opp, dtp->u.p.current_unit, &u_flags);
|
||||
|
|
Loading…
Reference in New Issue