This is the mail archive of the 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]

Re: [PATCH] Fix array access beyond bounds in test cases

On 11/09/2012 12:12 AM, Siddhesh Poyarekar wrote:

I found that some test cases access arrays beyond their bounds.  I
looked up their originating bugzillas and found that the test
cases for pr22506 and pr34005 were likely to be typos since the
original test cases in the report do not have this problem.  For
pr31227 however, I am inclined to think that the test case is
incorrect.  I am not sure what the test case verifies since the array
accesses are obviously beyond bounds.



2012-11-09 Siddhesh Poyarekar <>

	* gcc.dg/Warray-bounds-3.c (bar): Keep array access within
	bounds for ABDAY, DAY, ABMON, MON, AM_PM.
	* gcc.dg/vect/pr22506.c (foo): Reduce loop iterations to within
	array bounds.
	* gcc.dg/vect/pr34005.c (XdmcpUnwrap): Likewise.
For 31227 it's checking that an address formed by first computing an address outside the array, then adding an offset with the end result pointing at a valid location inside the array doesn't generate an incorrect warning.

This style of address computation can sometimes be advantageous for the loop optimizers to generate (my recollection is it's invalid C/C++ at the source level).

The off-by-one aspects of 31227 ought to be corrected.

Ok for the trunk,

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