diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-03-03 08:05:45 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-03-03 08:07:16 +0100 |
commit | 006693a59f7cd1310aed53a2816020bedf1fb742 (patch) | |
tree | 95696ff7fb8d784e3d29ae93b796bd1f499eac4e /libgfortran | |
parent | f8e7f3f3f33e22721a28772cc3f9b616e48cd1c9 (diff) | |
download | gcc-006693a59f7cd1310aed53a2816020bedf1fb742.zip gcc-006693a59f7cd1310aed53a2816020bedf1fb742.tar.gz gcc-006693a59f7cd1310aed53a2816020bedf1fb742.tar.bz2 |
libgfortran: Fix negation for largest integer [PR81986]
libgfortran/ChangeLog:
2021-03-01 Vittorio Zecca <zeccav@gmail.com>
Tobias Burnus <tobias@codesourcery.com>
PR libfortran/81986
* runtime/string.c (gfc_itoa): Cast to unsigned before
negating.
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/runtime/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c index 37c4da0..536a9cd 100644 --- a/libgfortran/runtime/string.c +++ b/libgfortran/runtime/string.c @@ -196,7 +196,7 @@ gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len) if (n < 0) { negative = 1; - t = -n; /*must use unsigned to protect from overflow*/ + t = -(GFC_UINTEGER_LARGEST) n; /* Must use unsigned to protect from overflow. */ } p = buffer + GFC_ITOA_BUF_SIZE - 1; |