[PATCH] D19968: [scan-build] fix warnings emitted on LLVM Hexagon code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 14:22:10 PDT 2016


apelete added inline comments.

================
Comment at: lib/Target/Hexagon/HexagonInstrInfo.cpp:1304
@@ -1303,3 +1303,3 @@
   // that operand has been constant extended.
-  bool OpCExtended[4];
+  bool OpCExtended[4] = {false};
   if (NumOperands > 4)
----------------
kparzysz wrote:
> The array OpCExtended is initialized in the loop below (line 1308).
This one was added to suppress a warning in the following case:

1305.	​  if (NumOperands > 4)
1306.	​    NumOperands = 4;
1307.	​
1308.	​  for (int i = 0; i < NumOperands; i++)
1309.	​    OpCExtended[i] = (isOperandExtended(&MI, i) && isConstExtended(&MI));
1310.	​​  switch(Opc) {
...
1361.	​  case Hexagon::S4_storeiri_io:
1362.      return (OpCExtended[1] || isUInt<6>(MI.getOperand(1).getImm())) &&
1363.               (OpCExtended[2] || isInt<6>(MI.getOperand(2).getImm()));
...
1375.   }

If branches at lines 1305 and 1308 evaluate to 'false', then the branch condition at line 1362 would evaluate to a garbage value because OpCExtended wasn't initialized.

If this is OK for you, then I would need your help to commit this for me as I do not have commit access.

Thanks.


http://reviews.llvm.org/D19968





More information about the llvm-commits mailing list