aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@baylibre.com>2024-03-11 22:51:28 +0100
committerThomas Schwinge <tschwinge@baylibre.com>2024-03-11 22:51:28 +0100
commita95e21151a6366e7344d0f1983f99e318c5a7097 (patch)
tree11d987406d9ce8399ec1736477d971ef09344df2 /libgfortran/io/write.c
parent02d394b2736afa9a24ab3e1b8ad56fd6ac37e0f4 (diff)
parentaf4bb221153359f5948da917d5ef2df738bb1e61 (diff)
downloadgcc-a95e21151a6366e7344d0f1983f99e318c5a7097.zip
gcc-a95e21151a6366e7344d0f1983f99e318c5a7097.tar.gz
gcc-a95e21151a6366e7344d0f1983f99e318c5a7097.tar.bz2
Merge commit 'af4bb221153359f5948da917d5ef2df738bb1e61' into HEAD
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 5d47a6d..00c8fd2 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1179,6 +1179,15 @@ xtoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n)
uint8_t h, l;
int i;
+ /* write_z, which calls xtoa_big, is called from transfer.c,
+ formatted_transfer_scalar_write. There it is passed the kind as
+ 'len' argument, which means a maximum of 16. The buffer is large
+ enough, but the compiler does not know that, so shut up the
+ warning here. */
+
+ if (len > 16)
+ __builtin_unreachable ();
+
q = buffer;
if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
@@ -1212,15 +1221,7 @@ xtoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n)
}
}
- /* write_z, which calls xtoa_big, is called from transfer.c,
- formatted_transfer_scalar_write. There it is passed the kind as
- argument, which means a maximum of 16. The buffer is large
- enough, but the compiler does not know that, so shut up the
- warning here. */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-overflow"
*q = '\0';
-#pragma GCC diagnostic pop
if (*n == 0)
return "0";