From 396d3cc3cac4a41e99aa2e30c4ee4cec2d48af67 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 1 Oct 2021 10:22:55 +0200 Subject: [PATCH] ICU-21781 suppress Wstringop-overflow in decNumber MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently there are a few compiler warnings generated when using GCC 11.2.1: decNumber.cpp: In function ‘decNumber* uprv_decNumberSquareRoot_70( decNumber*, const decNumber*, decContext*)’: decNumber.cpp:2976:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 2976 | t->lsu[0]=9; t->lsu[1]=5; t->lsu[2]=2; | ~~~~~~~~~^~ In file included from decNumber.cpp:184: decNumber.h:89:19: note: at offset 1 into destination object ‘decNumber::lsu’ of size 1 89 | decNumberUnit lsu[DECNUMUNITS]; | ^~~ There is an ignore for array-bounds warnings in this file which was added in Commit 38f7c0625c3a49208cc573720deaafcd2843c381 ("ICU-8954 add pragma to slience clang/gcc 4.6 about array bound error"). This commit add an ignore for stringop-overflow to suppress this warning. --- icu4c/source/i18n/decNumber.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/icu4c/source/i18n/decNumber.cpp b/icu4c/source/i18n/decNumber.cpp index 71477d8202c..3b832c7d897 100644 --- a/icu4c/source/i18n/decNumber.cpp +++ b/icu4c/source/i18n/decNumber.cpp @@ -1414,6 +1414,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber #if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic ignored "-Wstringop-overflow" #endif U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber *rhs, decContext *set) { @@ -2829,6 +2830,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberShift(decNumber *res, const decNumber #if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic ignored "-Wstringop-overflow" #endif U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decNumber *rhs, decContext *set) { @@ -5626,6 +5628,7 @@ static const uShort LNnn[90]={9016, 8652, 8316, 8008, 7724, 7456, 7208, #if defined(__clang__) || U_GCC_MAJOR_MINOR >= 406 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" +#pragma GCC diagnostic ignored "-Wstringop-overflow" #endif decNumber * decLnOp(decNumber *res, const decNumber *rhs, decContext *set, uInt *status) {