[PATCH] Fix the broken aha.c test
Jim Stichnoth
stichnot at google.com
Wed Jul 3 10:34:00 PDT 2013
In the test suite, MultiSource/Applications/aha/aha.c makes an invalid
memory reference. A loop inside main() sets global numi=1 and calls
fix_operands(i=0), which executes:
...
if (i == numi - 1) { // If this is the last insn:
rs = numi + RI0 - 2; // Second from last reg.
...
rt = rs - 1; // Third from last reg.
if (pgm[i-1].opnd[0] != rt && ...
... && rt >= RI0) {
...
}
}
pgm is a global array of structs.
One can see that pgm[] is being illegally dereferenced with index -1.
One can also see that the last condition clause, "rt>=RI0", is equivalent
to "numi >= 3". The attached patch moves this clause to the beginning of
the condition, giving the same result without the illegal reference.
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130703/2e8b9a5f/attachment.html>
More information about the llvm-commits
mailing list