Commit 844234fb by Jerry DeLisle

re PR libfortran/25139 ("Invalid argument" error on I/O)

2005-12-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/25139
	* io/unix.c (fd_truncate): Set s->active to zero.
	PR libgfortran/25510
	* libgfortran.h: Add ERROR_INTERNAL and ERROR_INTERNAL_UNIT.
	* runtime/error.c (translate_error): Add messages for new errors.
	* io/list_read.c (next_char): Use new errors.
	* io/transfer.c (next_record_r) (next_record_w): Use new errors.

From-SVN: r109122
parent ff7417d4
2005-12-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> 2005-12-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25139
* io/unix.c (fd_truncate): Set s->active to zero.
PR libgfortran/25510
* libgfortran.h: Add ERROR_INTERNAL and ERROR_INTERNAL_UNIT.
* runtime/error.c (translate_error): Add messages for new errors.
* io/list_read.c (next_char): Use new errors.
* io/transfer.c (next_record_r) (next_record_w): Use new errors.
2005-12-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25550 PR libgfortran/25550
* io/file_pos.c (st_rewind): Reset bytes left so no error occurs in * io/file_pos.c (st_rewind): Reset bytes left so no error occurs in
next_record_r. next_record_r.
......
...@@ -164,7 +164,7 @@ next_char (st_parameter_dt *dtp) ...@@ -164,7 +164,7 @@ next_char (st_parameter_dt *dtp)
check for NULL here is cautionary. */ check for NULL here is cautionary. */
if (p == NULL) if (p == NULL)
{ {
generate_error (&dtp->common, ERROR_OS, NULL); generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL);
return '\0'; return '\0';
} }
......
...@@ -1702,7 +1702,7 @@ next_record_r (st_parameter_dt *dtp) ...@@ -1702,7 +1702,7 @@ next_record_r (st_parameter_dt *dtp)
record = record * dtp->u.p.current_unit->recl; record = record * dtp->u.p.current_unit->recl;
if (sseek (dtp->u.p.current_unit->s, record) == FAILURE) if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
{ {
generate_error (&dtp->common, ERROR_OS, NULL); generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL);
break; break;
} }
dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl; dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
...@@ -1863,7 +1863,10 @@ next_record_w (st_parameter_dt *dtp, int done) ...@@ -1863,7 +1863,10 @@ next_record_w (st_parameter_dt *dtp, int done)
record = record * dtp->u.p.current_unit->recl; record = record * dtp->u.p.current_unit->recl;
if (sseek (dtp->u.p.current_unit->s, record) == FAILURE) if (sseek (dtp->u.p.current_unit->s, record) == FAILURE)
goto io_error; {
generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL);
return;
}
dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl; dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
} }
......
...@@ -601,7 +601,7 @@ fd_truncate (unix_stream * s) ...@@ -601,7 +601,7 @@ fd_truncate (unix_stream * s)
} }
s->physical_offset = s->file_length = s->logical_offset; s->physical_offset = s->file_length = s->logical_offset;
s->active = 0;
return SUCCESS; return SUCCESS;
} }
......
...@@ -407,6 +407,8 @@ typedef enum ...@@ -407,6 +407,8 @@ typedef enum
ERROR_BAD_US, ERROR_BAD_US,
ERROR_READ_VALUE, ERROR_READ_VALUE,
ERROR_READ_OVERFLOW, ERROR_READ_OVERFLOW,
ERROR_INTERNAL,
ERROR_INTERNAL_UNIT,
ERROR_LAST /* Not a real error, the last error # + 1. */ ERROR_LAST /* Not a real error, the last error # + 1. */
} }
error_codes; error_codes;
......
...@@ -423,6 +423,14 @@ translate_error (int code) ...@@ -423,6 +423,14 @@ translate_error (int code)
p = "Numeric overflow on read"; p = "Numeric overflow on read";
break; break;
case ERROR_INTERNAL:
p = "Internal error in run-time library";
break;
case ERROR_INTERNAL_UNIT:
p = "Internal unit I/O error";
break;
default: default:
p = "Unknown error code"; p = "Unknown error code";
break; break;
......
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