Fix array-bounds errors in ICU decNumber.c
Bug: 6296427 - icu4c does not compile with -Werror=array-bounds.
decNumber struct allocates extra space at run time. Apply the fixes for
ICU ticket8953 to disable the warnings.
For more details, please see http://bugs.icu-project.org/trac/ticket/8954.
Change-Id: Ib8c4d2f48ebce99eb792a0e2abce35924e9f63b9
diff --git a/i18n/decNumber.c b/i18n/decNumber.c
index ab69078..66bdff0 100644
--- a/i18n/decNumber.c
+++ b/i18n/decNumber.c
@@ -1,7 +1,7 @@
/* ------------------------------------------------------------------ */
/* Decimal Number arithmetic module */
/* ------------------------------------------------------------------ */
-/* Copyright (c) IBM Corporation, 2000-2010. All rights reserved. */
+/* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */
/* */
/* This software is made available under the terms of the */
/* ICU License -- ICU 1.8.1 and later. */
@@ -1392,6 +1392,10 @@
/* fastpath in decLnOp. The final division is done to the requested */
/* precision. */
/* ------------------------------------------------------------------ */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber *rhs,
decContext *set) {
uInt status=0, ignore=0; /* status accumulators */
@@ -1527,6 +1531,9 @@
#endif
return res;
} /* decNumberLog10 */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic pop
+#endif
/* ------------------------------------------------------------------ */
/* decNumberMax -- compare two Numbers and return the maximum */
@@ -2800,6 +2807,10 @@
/* result setexp(approx, e div 2) % fix exponent */
/* end sqrt */
/* ------------------------------------------------------------------ */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decNumber *rhs,
decContext *set) {
decContext workset, approxset; /* work contexts */
@@ -3129,6 +3140,9 @@
#endif
return res;
} /* decNumberSquareRoot */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic pop
+#endif
/* ------------------------------------------------------------------ */
/* decNumberSubtract -- subtract two Numbers */
@@ -5584,6 +5598,10 @@
/* 5. The static buffers are larger than might be expected to allow */
/* for calls from decNumberPower. */
/* ------------------------------------------------------------------ */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
decNumber * decLnOp(decNumber *res, const decNumber *rhs,
decContext *set, uInt *status) {
uInt ignore=0; /* working status accumulator */
@@ -5805,6 +5823,9 @@
/* [status is handled by caller] */
return res;
} /* decLnOp */
+#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406))
+#pragma GCC diagnostic pop
+#endif
/* ------------------------------------------------------------------ */
/* decQuantizeOp -- force exponent to requested value */