RFA: Fix isl-ast-gen-if-1.c test
Jeff Law
law@redhat.com
Mon Jun 22 15:41:00 GMT 2015
On 06/22/2015 09:38 AM, Nick Clifton wrote:
> Hi Guys,
>
> The test file gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c file
> was generating an unexpected failure for the RX. When I investigated
> I found that a return address on the stack was being corrupted, and I
> tracked it down to the foo() function:
>
> foo (int a[], int n)
> {
> int i;
> for (i = 0; i < n; i++)
> {
> if (i < 25)
> a[i] = i;
> a[n - i] = 1;
> }
> }
>
> The problem is that when i is 0, the line a[n - i] writes to a[50]
> which is beyond the end of the a array. (In the RX case it writes
> over the return address on the stack).
>
> The patch below fixes the problem, although it could also be solved by
> increasing the size of the a array when it is declared in main().
>
> OK to apply ?
>
> Cheers
> Nick
>
> gcc/testsuite/ChangeLog
> 2015-06-22 Nick Clifton <nickc@redhat.com>
>
> * gcc.dg/graphite/isl-ast-gen-if-1.c (foo): Prevent writing after
> the end of the array.
I'd tend to prefer to change the size of the array -- adding another
conditional in the loop may have unintended consequences that possibly
scramble things just enough to compromise the test.
jeff
More information about the Gcc-patches
mailing list