re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 28 Sep 2019 19:14:47 +0000 (19:14 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sat, 28 Sep 2019 19:14:47 +0000 (19:14 +0000)
2019-09-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/91593
* io/io.h: Add gcc_unreachable().
* io/transfer.c (file_mode, current_mode,
formatted_transfer_scalar_read, formatted_transfer_scalar_write,
pre_position, next_record_r, next_record_w): Add and use
FORMATTED_UNSPECIFIED to enumeration.

From-SVN: r276255

libgfortran/ChangeLog
libgfortran/io/io.h
libgfortran/io/transfer.c

index 15d0e6a767b3261a47478f7ac4b504d7ea3ed765..e2c65075aa89b0eb19467eb1f2439bce2253eb1c 100644 (file)
@@ -1,3 +1,12 @@
+2019-09-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/91593
+       * io/io.h: Add gcc_unreachable().
+       * io/transfer.c (file_mode, current_mode,
+       formatted_transfer_scalar_read, formatted_transfer_scalar_write,
+       pre_position, next_record_r, next_record_w): Add and use
+       FORMATTED_UNSPECIFIED to enumeration.
+       
 2019-09-27  Maciej W. Rozycki  <macro@wdc.com>
 
        * configure: Regenerate.
index f5e63797ba105e38ab6e62790eaade61f3181713..bcd6dde9a5b83d4d87ad147a6b74ec42fe245e6d 100644 (file)
@@ -32,6 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include <gthr.h>
 
+#define gcc_unreachable() __builtin_unreachable ()
 
 /* POSIX 2008 specifies that the extended locale stuff is found in
    locale.h, but some systems have them in xlocale.h.  */
index c43360f6332b3510c2e790986ac0b6a7ed96f15d..4c5e210ce5a0c6d3e1bdead52550d34dd64cf6fa 100644 (file)
@@ -193,7 +193,8 @@ static const st_option async_opt[] = {
 
 typedef enum
 { FORMATTED_SEQUENTIAL, UNFORMATTED_SEQUENTIAL,
-  FORMATTED_DIRECT, UNFORMATTED_DIRECT, FORMATTED_STREAM, UNFORMATTED_STREAM
+  FORMATTED_DIRECT, UNFORMATTED_DIRECT, FORMATTED_STREAM,
+  UNFORMATTED_STREAM, FORMATTED_UNSPECIFIED
 }
 file_mode;
 
@@ -203,7 +204,7 @@ current_mode (st_parameter_dt *dtp)
 {
   file_mode m;
 
-  m = FORM_UNSPECIFIED;
+  m = FORMATTED_UNSPECIFIED;
 
   if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
     {
@@ -1727,17 +1728,17 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind
 
        case FMT_S:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_S;
+         dtp->u.p.sign_status = SIGN_PROCDEFINED;
          break;
 
        case FMT_SS:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_SS;
+         dtp->u.p.sign_status = SIGN_SUPPRESS;
          break;
 
        case FMT_SP:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_SP;
+         dtp->u.p.sign_status = SIGN_PLUS;
          break;
 
        case FMT_BN:
@@ -2186,17 +2187,17 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin
 
        case FMT_S:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_S;
+         dtp->u.p.sign_status = SIGN_PROCDEFINED;
          break;
 
        case FMT_SS:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_SS;
+         dtp->u.p.sign_status = SIGN_SUPPRESS;
          break;
 
        case FMT_SP:
          consume_data_flag = 0;
-         dtp->u.p.sign_status = SIGN_SP;
+         dtp->u.p.sign_status = SIGN_PLUS;
          break;
 
        case FMT_BN:
@@ -2766,6 +2767,8 @@ pre_position (st_parameter_dt *dtp)
     case UNFORMATTED_DIRECT:
       dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
       break;
+    case FORMATTED_UNSPECIFIED:
+      gcc_unreachable ();
     }
 
   dtp->u.p.current_unit->current_record = 1;
@@ -3637,6 +3640,8 @@ next_record_r (st_parameter_dt *dtp, int done)
          while (p != '\n');
        }
       break;
+    case FORMATTED_UNSPECIFIED:
+      gcc_unreachable ();
     }
 }
 
@@ -4002,6 +4007,8 @@ next_record_w (st_parameter_dt *dtp, int done)
        }
 
       break;
+    case FORMATTED_UNSPECIFIED:
+      gcc_unreachable ();
 
     io_error:
       generate_error (&dtp->common, LIBERROR_OS, NULL);