This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A question about SRA and out-of-bounds array accesses


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?

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?

Thanks for any insight,

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]