On Tue, Jan 20, 2009 at 12:06 PM, Martin Jambor <mjam...@suse.cz> wrote:
> Hi,
>
> I  have found the  testcase gcc/testsuite/gcc.dg/noncompile/920507-1.c
> failing when I was testing my new SRA.  The testcase is quite simple,
> should error out but no longer does:
>
> ----------------------------------------
> int *
> x(void)
> {
>  register int *a asm("unknown_register");  /* { dg-error "invalid register" } 
> */
>  int *v[1] = {a};
>  return v[1];
> }
> ----------------------------------------
>
> The  problem is  the  array index  in  the return  statement.  My  SRA
> replaces both accesses with separate scalars, the initialization which
> is never used then gets eliminated and thus there is no failure.
>
> The  first question is:  Is  the testcase  correct or  is that  out of
> bounds index simply a mistake?

I have fixed that testcase on alias-improvements branch already ;)
There we otherwise simply DSE the store and return some
uninitialized memory.

> The current implementation of SRA checks in_array_bounds_p() for every
> ARRAY_REF and  disables for scalarization  of the array if  it returns
> false.   The  second question  is  whether  this  is for  some  reason
> necessary or whether this was done only because of how the current SRA
> works.  Is this useful because of warnings?

I think simply scalarizing for the above testcase is ok - the behavior
is undefined anyway.

Richard.

> Thanks for any insight,
>
> Martin
>

Reply via email to