[PATCH] D19968: [scan-build] fix warnings emitted on LLVM Hexagon code base
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 15:06:49 PDT 2016
kparzysz 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)
----------------
apelete wrote:
> 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.
NumOperands is the number of operands in the instruction. S4_storeiri_io has 3, so NumOperands will be 3. The loop at 1308-1309 will initialize OpCExtended for i=0..2, so both references will be valid.
Repository:
rL LLVM
http://reviews.llvm.org/D19968
More information about the llvm-commits
mailing list