diff mbox

More out-of-bounds array accesses

Message ID alpine.LNX.2.00.1008271334570.28912@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Aug. 27, 2010, 11:36 a.m. UTC
...

There are appearantly also some here (but I'm not 100% sure)

FAIL: 25_algorithms/heap/1.cc execution test
FAIL: 25_algorithms/stable_partition/mem_check.cc execution test
FAIL: 25_algorithms/stable_sort/mem_check.cc execution test

and there's definitely some here (but I can't wrap my brain around
how to fix that)

FAIL: gcc.target/x86_64/abi/test_passing_structs.c execution,  -O2 
FAIL: gcc.target/x86_64/abi/test_passing_unions.c execution,  -O2 

Richard.

2010-08-27  Richard Guenther  <rguenther@suse.de>

	* gcc.dg/graphite/scop-1.c: Fix out-of-bound array accesses.
	* gcc.dg/graphite/scop-2.c: Likewise.
	* gcc.dg/graphite/scop-20.c: Likewise.
	* gcc.dg/vect/slp-25.c: Likewise.

Comments

Paolo Carlini Aug. 27, 2010, 12:14 p.m. UTC | #1
Hi,
> ...
>
> There are appearantly also some here (but I'm not 100% sure)
>
> FAIL: 25_algorithms/heap/1.cc execution test
>   
I had a quick look to this: I replaced every C array with a std::vector
of the same size (+ mechanically replaced, say, s1, with s1.begin()),
and built the testcase with -D_GLIBCXX_DEBUG. No errors at run time.
Thus, I'm pretty confident that should be ok.

Paolo.
Richard Biener Aug. 27, 2010, 12:26 p.m. UTC | #2
On Fri, 27 Aug 2010, Paolo Carlini wrote:

> Hi,
> > ...
> >
> > There are appearantly also some here (but I'm not 100% sure)
> >
> > FAIL: 25_algorithms/heap/1.cc execution test
> >   
> I had a quick look to this: I replaced every C array with a std::vector
> of the same size (+ mechanically replaced, say, s1, with s1.begin()),
> and built the testcase with -D_GLIBCXX_DEBUG. No errors at run time.
> Thus, I'm pretty confident that should be ok.

Another way to check would be to replace the local stack arrays
with heap allocated memory and run the testcase through valgrind.

Richard.
Paolo Carlini Aug. 27, 2010, 12:32 p.m. UTC | #3
On 08/27/2010 02:26 PM, Richard Guenther wrote:
> Another way to check would be to replace the local stack arrays
> with heap allocated memory and run the testcase through valgrind.
>   
Good idea, I'll do some of that too.

Paolo.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/graphite/scop-1.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/scop-1.c	(revision 163563)
+++ gcc/testsuite/gcc.dg/graphite/scop-1.c	(working copy)
@@ -3,7 +3,7 @@  void bar (void);
 int toto()
 {
   int i, j, k;
-  int a[100][100];
+  int a[101][100];
   int b[100];
 
   for (i = 1; i < 100; i++)
Index: gcc/testsuite/gcc.dg/graphite/scop-2.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/scop-2.c	(revision 163563)
+++ gcc/testsuite/gcc.dg/graphite/scop-2.c	(working copy)
@@ -3,7 +3,7 @@  void bar (void);
 int toto()
 {
   int i, j, k;
-  int a[100][100];
+  int a[101][100];
   int b[100];
 
   for (i = 1; i < 100; i++)
Index: gcc/testsuite/gcc.dg/graphite/scop-20.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/scop-20.c	(revision 163563)
+++ gcc/testsuite/gcc.dg/graphite/scop-20.c	(working copy)
@@ -3,7 +3,7 @@  void bar (void);
 int toto()
 {
   int i, j, k;
-  int a[100][100];
+  int a[101][100];
   int b[100];
 
   for (i = 1; i < 100; i++)
Index: gcc/testsuite/gcc.dg/vect/slp-25.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-25.c	(revision 163563)
+++ gcc/testsuite/gcc.dg/vect/slp-25.c	(working copy)
@@ -7,8 +7,8 @@ 
 
 /* Unaligned stores.  */
 
-int ia[N+1];
-short sa[N+1];
+int ia[N+2];
+short sa[N+2];
 
 int main1 (int n)
 {