Commit c0d16890 by Jerry DeLisle

re PR fortran/44934 (Bogus "Missing format for FORMATTED data transfer")

2010-07-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/44934
	* io/file_pos.c (st_endfile): Correctly set unit flags for form.

From-SVN: r162203
parent 5cb55204
2010-07-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/44934
* io/file_pos.c (st_endfile): Correctly set unit flags for form.
2010-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2010-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/37077 PR libfortran/37077
......
...@@ -338,7 +338,14 @@ st_endfile (st_parameter_filepos *fpp) ...@@ -338,7 +338,14 @@ st_endfile (st_parameter_filepos *fpp)
memset (&u_flags, '\0', sizeof (u_flags)); memset (&u_flags, '\0', sizeof (u_flags));
u_flags.access = ACCESS_SEQUENTIAL; u_flags.access = ACCESS_SEQUENTIAL;
u_flags.action = ACTION_READWRITE; u_flags.action = ACTION_READWRITE;
u_flags.form = FORM_UNSPECIFIED;
/* Is it unformatted? */
if (!(fpp->common.flags & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT
| IOPARM_DT_IONML_SET)))
u_flags.form = FORM_UNFORMATTED;
else
u_flags.form = FORM_UNSPECIFIED;
u_flags.delim = DELIM_UNSPECIFIED; u_flags.delim = DELIM_UNSPECIFIED;
u_flags.blank = BLANK_UNSPECIFIED; u_flags.blank = BLANK_UNSPECIFIED;
u_flags.pad = PAD_UNSPECIFIED; u_flags.pad = PAD_UNSPECIFIED;
......
...@@ -2136,49 +2136,49 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -2136,49 +2136,49 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
dtp->u.p.current_unit = get_unit (dtp, 1); dtp->u.p.current_unit = get_unit (dtp, 1);
if (dtp->u.p.current_unit->s == NULL) if (dtp->u.p.current_unit->s == NULL)
{ /* Open the unit with some default flags. */ { /* Open the unit with some default flags. */
st_parameter_open opp; st_parameter_open opp;
unit_convert conv; unit_convert conv;
if (dtp->common.unit < 0) if (dtp->common.unit < 0)
{ {
close_unit (dtp->u.p.current_unit); close_unit (dtp->u.p.current_unit);
dtp->u.p.current_unit = NULL; dtp->u.p.current_unit = NULL;
generate_error (&dtp->common, LIBERROR_BAD_OPTION, generate_error (&dtp->common, LIBERROR_BAD_OPTION,
"Bad unit number in statement"); "Bad unit number in statement");
return; return;
} }
memset (&u_flags, '\0', sizeof (u_flags)); memset (&u_flags, '\0', sizeof (u_flags));
u_flags.access = ACCESS_SEQUENTIAL; u_flags.access = ACCESS_SEQUENTIAL;
u_flags.action = ACTION_READWRITE; u_flags.action = ACTION_READWRITE;
/* Is it unformatted? */ /* Is it unformatted? */
if (!(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT if (!(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT
| IOPARM_DT_IONML_SET))) | IOPARM_DT_IONML_SET)))
u_flags.form = FORM_UNFORMATTED; u_flags.form = FORM_UNFORMATTED;
else else
u_flags.form = FORM_UNSPECIFIED; u_flags.form = FORM_UNSPECIFIED;
u_flags.delim = DELIM_UNSPECIFIED; u_flags.delim = DELIM_UNSPECIFIED;
u_flags.blank = BLANK_UNSPECIFIED; u_flags.blank = BLANK_UNSPECIFIED;
u_flags.pad = PAD_UNSPECIFIED; u_flags.pad = PAD_UNSPECIFIED;
u_flags.decimal = DECIMAL_UNSPECIFIED; u_flags.decimal = DECIMAL_UNSPECIFIED;
u_flags.encoding = ENCODING_UNSPECIFIED; u_flags.encoding = ENCODING_UNSPECIFIED;
u_flags.async = ASYNC_UNSPECIFIED; u_flags.async = ASYNC_UNSPECIFIED;
u_flags.round = ROUND_UNSPECIFIED; u_flags.round = ROUND_UNSPECIFIED;
u_flags.sign = SIGN_UNSPECIFIED; u_flags.sign = SIGN_UNSPECIFIED;
u_flags.status = STATUS_UNKNOWN; u_flags.status = STATUS_UNKNOWN;
conv = get_unformatted_convert (dtp->common.unit); conv = get_unformatted_convert (dtp->common.unit);
if (conv == GFC_CONVERT_NONE) if (conv == GFC_CONVERT_NONE)
conv = compile_options.convert; conv = compile_options.convert;
/* We use big_endian, which is 0 on little-endian machines /* We use big_endian, which is 0 on little-endian machines
and 1 on big-endian machines. */ and 1 on big-endian machines. */
switch (conv) switch (conv)
{ {
case GFC_CONVERT_NATIVE: case GFC_CONVERT_NATIVE:
case GFC_CONVERT_SWAP: case GFC_CONVERT_SWAP:
break; break;
...@@ -2194,18 +2194,18 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) ...@@ -2194,18 +2194,18 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
default: default:
internal_error (&opp.common, "Illegal value for CONVERT"); internal_error (&opp.common, "Illegal value for CONVERT");
break; break;
} }
u_flags.convert = conv; u_flags.convert = conv;
opp.common = dtp->common; opp.common = dtp->common;
opp.common.flags &= IOPARM_COMMON_MASK; opp.common.flags &= IOPARM_COMMON_MASK;
dtp->u.p.current_unit = new_unit (&opp, dtp->u.p.current_unit, &u_flags); dtp->u.p.current_unit = new_unit (&opp, dtp->u.p.current_unit, &u_flags);
dtp->common.flags &= ~IOPARM_COMMON_MASK; dtp->common.flags &= ~IOPARM_COMMON_MASK;
dtp->common.flags |= (opp.common.flags & IOPARM_COMMON_MASK); dtp->common.flags |= (opp.common.flags & IOPARM_COMMON_MASK);
if (dtp->u.p.current_unit == NULL) if (dtp->u.p.current_unit == NULL)
return; return;
} }
/* Check the action. */ /* Check the action. */
......
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