re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 2 Oct 2019 02:35:14 +0000 (02:35 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 2 Oct 2019 02:35:14 +0000 (02:35 +0000)
2019-10-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/91593
* io/read.c (read_decimal): Cast constant to size_t to turn off
a bogus warning.
* io/write.c (btoa_big): Use memset in lieu of setting the null
byte in a string buffer to turn off a bogus warning.

From-SVN: r276439

libgfortran/ChangeLog
libgfortran/io/read.c
libgfortran/io/write.c

index e2c65075aa89b0eb19467eb1f2439bce2253eb1c..3f69e567ef7701dc3482c3d03d1a0352955f9795 100644 (file)
@@ -1,3 +1,11 @@
+2019-10-01  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libfortran/91593
+       * io/read.c (read_decimal): Cast constant to size_t to turn off
+       a bogus warning.
+       * io/write.c (btoa_big): Use memset in lieu of setting the null
+       byte in a string buffer to turn off a bogus warning.
+
 2019-09-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/91593
index be9f6cb6f76c1f6c87ee2b1d12b9bab113fa8479..4a77e4384b75043937ac28b537e45f7376a7dac9 100644 (file)
@@ -638,7 +638,7 @@ read_decimal (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
   /* This is a legacy extension, and the frontend will only allow such cases
    * through when -fdec-format-defaults is passed.
    */
-  if (w == DEFAULT_WIDTH)
+  if (w == (size_t) DEFAULT_WIDTH)
     w = default_width_for_integer (length);
 
   p = read_block_form (dtp, &w);
index 4ef35561fdd70a588968c3c2cc8ef28f0c8245be..eacd1f79715a88a595a22175a43aee0eeb1f0a68 100644 (file)
@@ -1048,8 +1048,6 @@ btoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n)
        }
     }
 
-  *q = '\0';
-
   if (*n == 0)
     return "0";
 
@@ -1207,6 +1205,9 @@ write_b (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
   char itoa_buf[GFC_BTOA_BUF_SIZE];
   GFC_UINTEGER_LARGEST n = 0;
 
+  /* Ensure we end up with a null terminated string.  */
+  memset(itoa_buf, '\0', GFC_BTOA_BUF_SIZE);
+
   if (len > (int) sizeof (GFC_UINTEGER_LARGEST))
     {
       p = btoa_big (source, itoa_buf, len, &n);