From aab2cc3a20af9ebe9ddb8dfd15089f131f95817f Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Fri, 20 Oct 2017 14:06:42 +0200 Subject: [PATCH] Fix the build of base/numerics with GCC Initialize the uninitialized variables where the build is failing. BUG=776705 Change-Id: I5782e18086a752b3676f8738930bf0553f3f97ad --- base/numerics/checked_math_impl.h | 6 +++--- base/numerics/clamped_math_impl.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base/numerics/checked_math_impl.h b/base/numerics/checked_math_impl.h index 2926b37b5e..e083389ebf 100644 --- a/base/numerics/checked_math_impl.h +++ b/base/numerics/checked_math_impl.h @@ -67,7 +67,7 @@ struct CheckedAddOp::value) { presult = static_cast(x) + static_cast(y); @@ -127,7 +127,7 @@ struct CheckedSubOp::value) { presult = static_cast(x) - static_cast(y); @@ -183,7 +183,7 @@ struct CheckedMulOp::is_supported) { // The fast op may be available with the promoted type. diff --git a/base/numerics/clamped_math_impl.h b/base/numerics/clamped_math_impl.h index 7b5e4346f2..303a7e945a 100644 --- a/base/numerics/clamped_math_impl.h +++ b/base/numerics/clamped_math_impl.h @@ -87,7 +87,7 @@ struct ClampedAddOp(IsValueNegative(y)); - V result; + V result = {}; return BASE_NUMERICS_LIKELY((CheckedAddOp::Do(x, y, &result))) ? result : saturated; @@ -114,7 +114,7 @@ struct ClampedSubOp(!IsValueNegative(y)); - V result; + V result = {}; return BASE_NUMERICS_LIKELY((CheckedSubOp::Do(x, y, &result))) ? result : saturated; @@ -136,7 +136,7 @@ struct ClampedMulOp::is_supported) return ClampedMulFastOp::template Do(x, y); - V result; + V result = {}; const V saturated = CommonMaxOrMin(IsValueNegative(x) ^ IsValueNegative(y)); return BASE_NUMERICS_LIKELY((CheckedMulOp::Do(x, y, &result))) @@ -156,7 +156,7 @@ struct ClampedDivOp::type; template static constexpr V Do(T x, U y) { - V result; + V result = {}; if (BASE_NUMERICS_LIKELY((CheckedDivOp::Do(x, y, &result)))) return result; // Saturation goes to max, min, or NaN (if x is zero). @@ -176,7 +176,7 @@ struct ClampedModOp::type; template static constexpr V Do(T x, U y) { - V result; + V result = {}; return BASE_NUMERICS_LIKELY((CheckedModOp::Do(x, y, &result))) ? result : x; -- 2.14.2