aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2008-03-27 18:49:43 +0100
committerUros Bizjak <uros@gcc.gnu.org>2008-03-27 18:49:43 +0100
commit75f8beae9795785e425c3d8dce5360a2b7ad1812 (patch)
tree40df8a1368f6b431d1724588074f4873393a02a4
parentffd837fe164a08ed4e3315009d61bb24c69fe04d (diff)
downloadgcc-75f8beae9795785e425c3d8dce5360a2b7ad1812.zip
gcc-75f8beae9795785e425c3d8dce5360a2b7ad1812.tar.gz
gcc-75f8beae9795785e425c3d8dce5360a2b7ad1812.tar.bz2
multi-ix.c: Limit CHUNK size between 1 and 500.
* gcc.c-torture/execute/multi-ix.c: Limit CHUNK size between 1 and 500. (main): Exit early for CHUNK less than 40 to avoid stack corruption. From-SVN: r133648
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/multi-ix.c16
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1752896..5a52593 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-26 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.c-torture/execute/multi-ix.c: Limit CHUNK size between 1 and 500.
+ (main): Exit early for CHUNK less than 40 to avoid stack corruption.
+
2008-03-27 Richard Guenther <rguenther@suse.de>
PR c/32511
@@ -10,7 +15,7 @@
2008-03-27 Douglas Gregor <doug.gregor@gmail.com>
- * g++.dg/cpp0x/variadic91.C: New.
+ * g++.dg/cpp0x/variadic91.C: New.
2008-03-27 Zdenek Dvorak <ook@ucw.cz>
@@ -37,7 +42,7 @@
2008-03-26 Richard Guenther <rguenther@suse.de>
- Revert
+ Revert:
2008-03-26 Richard Guenther <rguenther@suse.de>
* gcc.dg/fold-addr-1.c: New testcase.
diff --git a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
index c9f28b0..377f08c 100644
--- a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
+++ b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
@@ -21,8 +21,15 @@
Subtract the last two off STACK_SIZE and figure out what the maximum
chunk size can be. We make the last bit conservative to account for
- register saves and other processor-dependent saving. */
-#define CHUNK ((STACK_SIZE-40*sizeof(int)-256*sizeof(void *))/40/sizeof(int))
+ register saves and other processor-dependent saving. Limit the
+ chunk size to some sane values. */
+
+#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
+#define CHUNK \
+ MIN (500, (MAX (1, (signed)(STACK_SIZE-40*sizeof(int)-256*sizeof(void *)) \
+ / (signed)(40*sizeof(int)))))
#else
#define CHUNK 500
#endif
@@ -146,6 +153,11 @@ f (int n)
int
main ()
{
+ /* CHUNK needs to be at least 40 to avoid stack corruption,
+ since index variable i0 in "a[i0] = i0" equals 39. */
+ if (CHUNK < 40)
+ exit (0);
+
f (1);
exit (0);
}