https://github.com/python/cpython/commit/6c63afc3be9dd612f587fe7869c1f317d5ea37cc
commit: 6c63afc3be9dd612f587fe7869c1f317d5ea37cc
branch: main
author: Sergey B Kirpichev <[email protected]>
committer: vstinner <[email protected]>
date: 2025-01-30T11:57:55+01:00
summary:

gh-129467: Fix compiler warning in mpdecimal word_to_string() (#116346)

Turn off false-positive -Wstringop-overflow in word_to_string().

files:
M Misc/sbom.spdx.json
M Modules/_decimal/libmpdec/io.c

diff --git a/Misc/sbom.spdx.json b/Misc/sbom.spdx.json
index b4d785f65639a5..316c266b7e4fd6 100644
--- a/Misc/sbom.spdx.json
+++ b/Misc/sbom.spdx.json
@@ -1280,11 +1280,11 @@
       "checksums": [
         {
           "algorithm": "SHA1",
-          "checksumValue": "9dcb50e3f9c3245972731be5da0b28e7583198d9"
+          "checksumValue": "5d6fdd98730584f74f7b731da6e488fe234504b3"
         },
         {
           "algorithm": "SHA256",
-          "checksumValue": 
"7cac49fef5e9d952ec9390bf81c54d83f1b5da32fdf76091c2f0770ed943b7fe"
+          "checksumValue": 
"d74f365463166891f62e1326d22b2d39d865776b7ea5e0df2aea5eede4d85b0f"
         }
       ],
       "fileName": "Modules/_decimal/libmpdec/io.c"
diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c
index 4e95b8964c8e5d..bdcca001659bc0 100644
--- a/Modules/_decimal/libmpdec/io.c
+++ b/Modules/_decimal/libmpdec/io.c
@@ -347,6 +347,10 @@ mpd_qset_string_exact(mpd_t *dec, const char *s, uint32_t 
*status)
    or the location of a decimal point. */
 #define EXTRACT_DIGIT(s, x, d, dot) \
         if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
+  #pragma GCC diagnostic push
+  #pragma GCC diagnostic ignored "-Wstringop-overflow"
+#endif
 static inline char *
 word_to_string(char *s, mpd_uint_t x, int n, char *dot)
 {
@@ -378,6 +382,9 @@ word_to_string(char *s, mpd_uint_t x, int n, char *dot)
     *s = '\0';
     return s;
 }
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 12
+  #pragma GCC diagnostic pop
+#endif
 
 /* Print exponent x to string s. Undefined for MPD_SSIZE_MIN. */
 static inline char *

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to