From 85a44e24dcca5282e68935f5804781e5ae312558 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 30 Jul 2015 03:41:22 -0400 Subject: [PATCH] cpu: Fix issue identified by UBSan --- src/cpu/func_unit.cc | 2 ++ src/cpu/func_unit.hh | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cpu/func_unit.cc b/src/cpu/func_unit.cc index 6d009a440..3c2f1049d 100644 --- a/src/cpu/func_unit.cc +++ b/src/cpu/func_unit.cc @@ -42,6 +42,8 @@ using namespace std; // FuncUnit::FuncUnit() { + opLatencies.fill(0); + pipelined.fill(false); capabilityList.reset(); } diff --git a/src/cpu/func_unit.hh b/src/cpu/func_unit.hh index 721a69df1..638195509 100644 --- a/src/cpu/func_unit.hh +++ b/src/cpu/func_unit.hh @@ -31,6 +31,7 @@ #ifndef __CPU_FUNC_UNIT_HH__ #define __CPU_FUNC_UNIT_HH__ +#include #include #include #include @@ -84,8 +85,8 @@ typedef std::vector::const_iterator FUDDiterator; class FuncUnit { private: - unsigned opLatencies[Num_OpClasses]; - bool pipelined[Num_OpClasses]; + std::array opLatencies; + std::array pipelined; std::bitset capabilityList; public: -- 2.30.2