+2006-04-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/27138
+ * io/list_read.c (eat_line): New function.
+ (parse_repeat): Use new function and free_saved.
+ (read_logical): Same.
+ (read_integer): Use new function.
+ (parse_real): Use nml_bad_return and new function.
+ (read_complex): Use new function and free_saved.
+ (read_real): Same.
+
2006-04-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/26766
}
}
+
+/* This function reads characters through to the end of the current line and
+ just ignores them. */
+
+static void
+eat_line (st_parameter_dt *dtp)
+{
+ char c;
+ if (!is_internal_unit (dtp))
+ do
+ c = next_char (dtp);
+ while (c != '\n');
+}
+
+
/* This function is needed to catch bad conversions so that namelist can
attempt to see if dtp->u.p.saved_string contains a new object name rather
than a bad value. */
return 0;
bad_repeat:
+
+ eat_line (dtp);
+ free_saved (dtp);
st_sprintf (message, "Bad repeat count in item %d of list input",
dtp->u.p.item_count);
-
generate_error (&dtp->common, ERROR_READ_VALUE, message);
return 1;
}
static void
l_push_char (st_parameter_dt *dtp, char c)
{
- char *new;
-
if (dtp->u.p.line_buffer == NULL)
{
dtp->u.p.line_buffer = get_mem (SCRATCH_SIZE);
if (nml_bad_return (dtp, c))
return;
+ eat_line (dtp);
+ free_saved (dtp);
+ if (dtp->u.p.line_buffer != NULL)
+ free_mem (dtp->u.p.line_buffer);
st_sprintf (message, "Bad logical value while reading item %d",
dtp->u.p.item_count);
-
generate_error (&dtp->common, ERROR_READ_VALUE, message);
return;
if (nml_bad_return (dtp, c))
return;
-
+
+ eat_line (dtp);
free_saved (dtp);
-
st_sprintf (message, "Bad integer for item %d in list input",
dtp->u.p.item_count);
generate_error (&dtp->common, ERROR_READ_VALUE, message);
return m;
bad:
+
+ if (nml_bad_return (dtp, c))
+ return 0;
+
+ eat_line (dtp);
free_saved (dtp);
st_sprintf (message, "Bad floating point number for item %d",
dtp->u.p.item_count);
if (nml_bad_return (dtp, c))
return;
+ eat_line (dtp);
+ free_saved (dtp);
st_sprintf (message, "Bad complex value in item %d of list input",
dtp->u.p.item_count);
-
generate_error (&dtp->common, ERROR_READ_VALUE, message);
}
if (nml_bad_return (dtp, c))
return;
+ eat_line (dtp);
+ free_saved (dtp);
st_sprintf (message, "Bad real number in item %d of list input",
dtp->u.p.item_count);
-
generate_error (&dtp->common, ERROR_READ_VALUE, message);
}