]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/25139 ("Invalid argument" error on I/O)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 28 Dec 2005 20:58:08 +0000 (20:58 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 28 Dec 2005 20:58:08 +0000 (20:58 +0000)
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

libgfortran/ChangeLog
libgfortran/io/list_read.c
libgfortran/io/transfer.c
libgfortran/io/unix.c
libgfortran/libgfortran.h
libgfortran/runtime/error.c

index c9fdb6bc30cb0f026e5d257513b71627374da2a7..d60193afb584072b8f723a4b86ad621125b43cc2 100644 (file)
@@ -1,3 +1,13 @@
+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
index b11f6a523ff20257e8083a4fb5fec2d051fb42bd..879cf8f3230a3624616132b9d21ae5e7b3fbd457 100644 (file)
@@ -164,7 +164,7 @@ next_char (st_parameter_dt *dtp)
             check for NULL here is cautionary. */
          if (p == NULL)
            {
-             generate_error (&dtp->common, ERROR_OS, NULL);
+             generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL);
              return '\0';
            }
 
index 7ad1fffc68d9016264bb9b07c4261cbcc8102130..2c12294398eee993f97c4df18e21d79c26b3c983 100644 (file)
@@ -1702,7 +1702,7 @@ next_record_r (st_parameter_dt *dtp)
              record = record * dtp->u.p.current_unit->recl;
              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;
                }
              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)
              record = record * dtp->u.p.current_unit->recl;
 
              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;
            }
index 6750b6f614208e1d91c3f42a6fd26128fc781e67..237f09e99308aa47585cbd7618086a32358a979f 100644 (file)
@@ -601,7 +601,7 @@ fd_truncate (unix_stream * s)
     }
 
   s->physical_offset = s->file_length = s->logical_offset;
-
+  s->active = 0;
   return SUCCESS;
 }
 
index aacc7b8c8c5593303e6d46d62c9e7bf464c0a0e3..b64b60b1894be68e8852bb343c94f0b5f6da255c 100644 (file)
@@ -407,6 +407,8 @@ typedef enum
   ERROR_BAD_US,
   ERROR_READ_VALUE,
   ERROR_READ_OVERFLOW,
+  ERROR_INTERNAL,
+  ERROR_INTERNAL_UNIT,
   ERROR_LAST                   /* Not a real error, the last error # + 1.  */
 }
 error_codes;
index 7f85b5ceb3a815d3d98f21c0de423c4523bcb590..2d3c0689adc226d587705423329d241f44ade146 100644 (file)
@@ -423,6 +423,14 @@ translate_error (int code)
       p = "Numeric overflow on read";
       break;
 
+    case ERROR_INTERNAL:
+      p = "Internal error in run-time library";
+      break;
+
+    case ERROR_INTERNAL_UNIT:
+      p = "Internal unit I/O error";
+      break;
+
     default:
       p = "Unknown error code";
       break;