cpu: Fix issue identified by UBSan
authorAndreas Hansson <andreas.hansson@arm.com>
Thu, 30 Jul 2015 07:41:22 +0000 (03:41 -0400)
committerAndreas Hansson <andreas.hansson@arm.com>
Thu, 30 Jul 2015 07:41:22 +0000 (03:41 -0400)
src/cpu/func_unit.cc
src/cpu/func_unit.hh

index 6d009a440093572ceb25bee452207f7132adce4d..3c2f1049db8c6667b367e581910c3baafe2368f7 100644 (file)
@@ -42,6 +42,8 @@ using namespace std;
 //
 FuncUnit::FuncUnit()
 {
+    opLatencies.fill(0);
+    pipelined.fill(false);
     capabilityList.reset();
 }
 
index 721a69df1149b798d5bec1473e3f550bbc46da06..6381955091c4deba5fa1f2f4563e51d3c19d4850 100644 (file)
@@ -31,6 +31,7 @@
 #ifndef __CPU_FUNC_UNIT_HH__
 #define __CPU_FUNC_UNIT_HH__
 
+#include <array>
 #include <bitset>
 #include <string>
 #include <vector>
@@ -84,8 +85,8 @@ typedef std::vector<FUDesc *>::const_iterator FUDDiterator;
 class FuncUnit
 {
   private:
-    unsigned opLatencies[Num_OpClasses];
-    bool pipelined[Num_OpClasses];
+    std::array<unsigned, Num_OpClasses> opLatencies;
+    std::array<bool, Num_OpClasses> pipelined;
     std::bitset<Num_OpClasses> capabilityList;
 
   public: