Commit 03e957f8 by Jerry DeLisle

re PR fortran/26554 ([gfortran] incorrect behaviour when reading a logical variable from a string)

2006-03-05  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/26554
	* io/list_read.c (read_logical): Return the value if not in namelist
	mode.

From-SVN: r111738
parent 0bf8477d
2006-03-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/26554
* io/list_read.c (read_logical): Return the value if not in namelist
mode.
2006-03-03 Thomas Koenig <Thomas.Koenig@online.de> 2006-03-03 Thomas Koenig <Thomas.Koenig@online.de>
PR fortran/25031 PR fortran/25031
......
...@@ -647,18 +647,17 @@ read_logical (st_parameter_dt *dtp, int length) ...@@ -647,18 +647,17 @@ read_logical (st_parameter_dt *dtp, int length)
c = next_char (dtp); c = next_char (dtp);
if (is_separator(c)) if (is_separator(c))
{ {
/* All done if this is not a namelist read. */
if (!dtp->u.p.namelist_mode)
goto logical_done;
unget_char (dtp, c); unget_char (dtp, c);
eat_separator (dtp); eat_separator (dtp);
c = next_char (dtp); c = next_char (dtp);
if (c != '=') if (c != '=')
{ {
unget_char (dtp, c); unget_char (dtp, c);
dtp->u.p.item_count = 0; goto logical_done;
dtp->u.p.line_buffer_enabled = 0;
dtp->u.p.saved_type = BT_LOGICAL;
dtp->u.p.saved_length = length;
set_integer ((int *) dtp->u.p.value, v, length);
return;
} }
} }
...@@ -670,7 +669,8 @@ read_logical (st_parameter_dt *dtp, int length) ...@@ -670,7 +669,8 @@ read_logical (st_parameter_dt *dtp, int length)
dtp->u.p.item_count = 0; dtp->u.p.item_count = 0;
return; return;
} }
}
}
bad_logical: bad_logical:
...@@ -681,6 +681,15 @@ read_logical (st_parameter_dt *dtp, int length) ...@@ -681,6 +681,15 @@ read_logical (st_parameter_dt *dtp, int length)
dtp->u.p.item_count); dtp->u.p.item_count);
generate_error (&dtp->common, ERROR_READ_VALUE, message); generate_error (&dtp->common, ERROR_READ_VALUE, message);
return;
logical_done:
dtp->u.p.item_count = 0;
dtp->u.p.line_buffer_enabled = 0;
dtp->u.p.saved_type = BT_LOGICAL;
dtp->u.p.saved_length = length;
set_integer ((int *) dtp->u.p.value, v, length);
} }
......
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