From 3ccc950c7902694ff9030b735e6decc87b16bcdd Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 18 Dec 2023 07:46:50 -0800 Subject: Add a pragma to disable a stringop-overflow warning for GCC12+ PiperOrigin-RevId: 591894838 Change-Id: Ib3fe72d255f49320e2728c210ba1faabc81e0ef8 --- absl/strings/internal/cord_internal.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/absl/strings/internal/cord_internal.h b/absl/strings/internal/cord_internal.h index a487fd59..8744540e 100644 --- a/absl/strings/internal/cord_internal.h +++ b/absl/strings/internal/cord_internal.h @@ -101,8 +101,16 @@ inline void SmallMemmove(char* dst, const char* src, size_t n) { if (nullify_tail) { memset(dst + 7, 0, 8); } + // GCC 12 has a false-positive -Wstringop-overflow warning here. +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif memcpy(dst, &buf1, 8); memcpy(dst + n - 8, &buf2, 8); +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic pop +#endif } else if (n >= 4) { uint32_t buf1; uint32_t buf2; -- cgit v1.2.3