arch-arm: just return the fault in twoEqualRegInst{,Fp}
authorIru Cai <mytbk920423@gmail.com>
Thu, 10 Sep 2020 06:18:19 +0000 (14:18 +0800)
committerBobby R. Bruce <bbruce@ucdavis.edu>
Thu, 10 Sep 2020 16:54:09 +0000 (16:54 +0000)
This prevents the code from using the uninitialized destReg when
running the ``if (imm >= eCount)`` branch, which will make GCC 10.2
report a -Werror=maybe-uninitialized error when building gem5.opt.

Change-Id: Ie6e7d3d47a1b65b840b2106263ecfc21eb6af26b
Signed-off-by: Iru Cai <mytbk920423@gmail.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34275
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/isa/insts/neon.isa

index d536d5b8d010cde004998bf58a16661c97cf9bfa..1dfefe7c30bf264b241d264b78492f04a31f4e75 100644 (file)
@@ -1417,8 +1417,8 @@ let {{
             readDestCode = 'destElem = letoh(destReg.elements[i]);'
         eWalkCode += '''
         if (imm >= eCount) {
-            fault = std::make_shared<UndefinedInstruction>(machInst, false,
-                                                           mnemonic);
+            return std::make_shared<UndefinedInstruction>(machInst, false,
+                                                          mnemonic);
         } else {
             for (unsigned i = 0; i < eCount; i++) {
                 Element srcElem1 = letoh(srcReg1.elements[i]);
@@ -1519,8 +1519,8 @@ let {{
             readDestCode = 'destReg = destRegs[i];'
         eWalkCode += '''
         if (imm >= eCount) {
-            fault = std::make_shared<UndefinedInstruction>(machInst, false,
-                                                           mnemonic);
+            return std::make_shared<UndefinedInstruction>(machInst, false,
+                                                          mnemonic);
         } else {
             for (unsigned i = 0; i < rCount; i++) {
                 float srcReg1 = srcRegs1[i];