aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2017-06-10 06:59:26 +0000
committerTom de Vries <vries@gcc.gnu.org>2017-06-10 06:59:26 +0000
commit0069a009910c4d8d3d95db6a3760abd0580f4183 (patch)
tree9143dccb0a15f00edab2b041b9e77ebf6f1e5550 /gcc
parente6d7d61861c8fa7207570abb6fc23c5a2921e4da (diff)
downloadgcc-0069a009910c4d8d3d95db6a3760abd0580f4183.zip
gcc-0069a009910c4d8d3d95db6a3760abd0580f4183.tar.gz
gcc-0069a009910c4d8d3d95db6a3760abd0580f4183.tar.bz2
Add effective target stack_size
2017-06-10 Tom de Vries <tom@codesourcery.com> * lib/target-supports.exp (check_effective_target_stack_size) (dg-effective-target-value): New proc. * lib/gcc.exp (gcc_target_compile): Remove adding of DSTACK_SIZE to additional_flags. * lib/objc.exp (objc_target_compile): Same. * lib/profopt.exp (profopt-get-options): Allow dg-additional-options. * g++.old-deja/g++.eh/badalloc1.C: Add -DSTACK_SIZE=<value> using dg-additional-options. * gcc.c-torture/compile/20080806-1.c: Same. * gcc.c-torture/compile/920723-1.c: Same. * gcc.c-torture/compile/930621-1.c: Same. * gcc.c-torture/compile/991214-2.c: Same. * gcc.c-torture/compile/bcopy.c: Same. * gcc.c-torture/compile/memtst.c: Same. * gcc.c-torture/compile/msp.c: Same. * gcc.c-torture/compile/stuct.c: Same. * gcc.c-torture/execute/20011008-3.c: Same. * gcc.c-torture/execute/20030209-1.c: Same. * gcc.c-torture/execute/20031012-1.c: Same. * gcc.c-torture/execute/20040805-1.c: Same. * gcc.c-torture/execute/920410-1.c: Same. * gcc.c-torture/execute/920501-7.c: Same. * gcc.c-torture/execute/921113-1.c: Same. * gcc.c-torture/execute/921202-1.c: Same. * gcc.c-torture/execute/921208-2.c: Same. * gcc.c-torture/execute/930106-1.c: Same. * gcc.c-torture/execute/930406-1.c: Same. * gcc.c-torture/execute/950221-1.c: Same. * gcc.c-torture/execute/960521-1.c: Same. * gcc.c-torture/execute/980605-1.c: Same. * gcc.c-torture/execute/comp-goto-1.c: Same. * gcc.c-torture/execute/comp-goto-2.c: Same. * gcc.c-torture/execute/memcpy-1.c: Same. * gcc.c-torture/execute/multi-ix.c: Same. * gcc.c-torture/execute/nestfunc-4.c: Same. * gcc.c-torture/execute/pr20621-1.c: Same. * gcc.c-torture/execute/pr23135.c: Same. * gcc.c-torture/execute/pr28982b.c: Same. * gcc.dg/loop-3.c: Same. * gcc.dg/struct-ret-3.c: Same. * gcc.dg/torture/stackalign/comp-goto-1.c: Same. * gcc.dg/torture/stackalign/non-local-goto-4.c: Same. * gcc.dg/tree-prof/comp-goto-1.c: Same. * gcc.dg/tree-prof/pr44777.c: Same. * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): Document effective target stack_size. From-SVN: r249090
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/sourcebuild.texi7
-rw-r--r--gcc/testsuite/ChangeLog47
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080806-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/920723-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/930621-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/991214-2.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/bcopy.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/memtst.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/msp.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/stuct.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20011008-3.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20030209-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031012-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040805-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/920410-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/920501-7.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/921113-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/921202-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/921208-2.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/930106-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/930406-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/950221-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/960521-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/980605-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/memcpy-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/multi-ix.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr20621-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr23135.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr28982b.c2
-rw-r--r--gcc/testsuite/gcc.dg/loop-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/struct-ret-3.c3
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr44777.c2
-rw-r--r--gcc/testsuite/lib/gcc.exp3
-rw-r--r--gcc/testsuite/lib/objc.exp4
-rw-r--r--gcc/testsuite/lib/profopt.exp1
-rw-r--r--gcc/testsuite/lib/target-supports.exp21
44 files changed, 147 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4ab6f8a..99c54d1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-06-10 Tom de Vries <tom@codesourcery.com>
+
+ * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
+ Document effective target stack_size.
+
2017-06-09 David Malcolm <dmalcolm@redhat.com>
* diagnostic.c (diagnostic_report_diagnostic): Only add fixits
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 841e75a..cdb3a2c 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2093,6 +2093,13 @@ Target supports section anchors.
@item short_enums
Target defaults to short enums.
+@item stack_size
+Target has limited stack size. The stack size limit can be obtained using
+@code{[dg-effective-target-value stack_size]}. For example:
+@smallexample
+/* @{ dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" @{ target @{ stack_size @} @} @} */
+@end smallexample
+
@item static
Target supports @option{-static}.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cc36d7a..7ffa0c0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,50 @@
+2017-06-10 Tom de Vries <tom@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_stack_size)
+ (dg-effective-target-value): New proc.
+ * lib/gcc.exp (gcc_target_compile): Remove adding of DSTACK_SIZE to
+ additional_flags.
+ * lib/objc.exp (objc_target_compile): Same.
+ * lib/profopt.exp (profopt-get-options): Allow dg-additional-options.
+ * g++.old-deja/g++.eh/badalloc1.C: Add -DSTACK_SIZE=<value> using
+ dg-additional-options.
+ * gcc.c-torture/compile/20080806-1.c: Same.
+ * gcc.c-torture/compile/920723-1.c: Same.
+ * gcc.c-torture/compile/930621-1.c: Same.
+ * gcc.c-torture/compile/991214-2.c: Same.
+ * gcc.c-torture/compile/bcopy.c: Same.
+ * gcc.c-torture/compile/memtst.c: Same.
+ * gcc.c-torture/compile/msp.c: Same.
+ * gcc.c-torture/compile/stuct.c: Same.
+ * gcc.c-torture/execute/20011008-3.c: Same.
+ * gcc.c-torture/execute/20030209-1.c: Same.
+ * gcc.c-torture/execute/20031012-1.c: Same.
+ * gcc.c-torture/execute/20040805-1.c: Same.
+ * gcc.c-torture/execute/920410-1.c: Same.
+ * gcc.c-torture/execute/920501-7.c: Same.
+ * gcc.c-torture/execute/921113-1.c: Same.
+ * gcc.c-torture/execute/921202-1.c: Same.
+ * gcc.c-torture/execute/921208-2.c: Same.
+ * gcc.c-torture/execute/930106-1.c: Same.
+ * gcc.c-torture/execute/930406-1.c: Same.
+ * gcc.c-torture/execute/950221-1.c: Same.
+ * gcc.c-torture/execute/960521-1.c: Same.
+ * gcc.c-torture/execute/980605-1.c: Same.
+ * gcc.c-torture/execute/comp-goto-1.c: Same.
+ * gcc.c-torture/execute/comp-goto-2.c: Same.
+ * gcc.c-torture/execute/memcpy-1.c: Same.
+ * gcc.c-torture/execute/multi-ix.c: Same.
+ * gcc.c-torture/execute/nestfunc-4.c: Same.
+ * gcc.c-torture/execute/pr20621-1.c: Same.
+ * gcc.c-torture/execute/pr23135.c: Same.
+ * gcc.c-torture/execute/pr28982b.c: Same.
+ * gcc.dg/loop-3.c: Same.
+ * gcc.dg/struct-ret-3.c: Same.
+ * gcc.dg/torture/stackalign/comp-goto-1.c: Same.
+ * gcc.dg/torture/stackalign/non-local-goto-4.c: Same.
+ * gcc.dg/tree-prof/comp-goto-1.c: Same.
+ * gcc.dg/tree-prof/pr44777.c: Same.
+
2017-06-09 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
index 31c7300..f63d5c6 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
@@ -3,6 +3,7 @@
// itself call malloc(), and will fail if there is no more
// memory available.
// { dg-do run { xfail { { xstormy16-*-* *-*-darwin[3-7]* } || vxworks_rtp } } }
+// { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } }
// Copyright (C) 2000, 2002, 2003, 2010, 2012, 2014 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c
index c54e739..d0ee9cc 100644
--- a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* This used to ICE on s390x due to a reload bug. */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
diff --git a/gcc/testsuite/gcc.c-torture/compile/920723-1.c b/gcc/testsuite/gcc.c-torture/compile/920723-1.c
index 69b031e..c6351c37 100644
--- a/gcc/testsuite/gcc.c-torture/compile/920723-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/920723-1.c
@@ -1,3 +1,4 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#if defined(STACK_SIZE) && STACK_SIZE < 65536
# define GITT_SIZE 75
diff --git a/gcc/testsuite/gcc.c-torture/compile/930621-1.c b/gcc/testsuite/gcc.c-torture/compile/930621-1.c
index 4199bbe..13e997a 100644
--- a/gcc/testsuite/gcc.c-torture/compile/930621-1.c
+++ b/gcc/testsuite/gcc.c-torture/compile/930621-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L
#endif
diff --git a/gcc/testsuite/gcc.c-torture/compile/991214-2.c b/gcc/testsuite/gcc.c-torture/compile/991214-2.c
index 3e18d21..32dad4ff 100644
--- a/gcc/testsuite/gcc.c-torture/compile/991214-2.c
+++ b/gcc/testsuite/gcc.c-torture/compile/991214-2.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define HISTO_SIZE 9
#else
diff --git a/gcc/testsuite/gcc.c-torture/compile/bcopy.c b/gcc/testsuite/gcc.c-torture/compile/bcopy.c
index aed994e..cb7c05d 100644
--- a/gcc/testsuite/gcc.c-torture/compile/bcopy.c
+++ b/gcc/testsuite/gcc.c-torture/compile/bcopy.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
void
bcopy1 (s, d, c)
long long *s;
diff --git a/gcc/testsuite/gcc.c-torture/compile/memtst.c b/gcc/testsuite/gcc.c-torture/compile/memtst.c
index b5ef260..e165a22 100644
--- a/gcc/testsuite/gcc.c-torture/compile/memtst.c
+++ b/gcc/testsuite/gcc.c-torture/compile/memtst.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8
#else
diff --git a/gcc/testsuite/gcc.c-torture/compile/msp.c b/gcc/testsuite/gcc.c-torture/compile/msp.c
index 5d350fd..594cecb 100644
--- a/gcc/testsuite/gcc.c-torture/compile/msp.c
+++ b/gcc/testsuite/gcc.c-torture/compile/msp.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
# define A_SIZE (STACK_SIZE/sizeof(int))
#else
diff --git a/gcc/testsuite/gcc.c-torture/compile/stuct.c b/gcc/testsuite/gcc.c-torture/compile/stuct.c
index deb838d..59acd57 100644
--- a/gcc/testsuite/gcc.c-torture/compile/stuct.c
+++ b/gcc/testsuite/gcc.c-torture/compile/stuct.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#define SIZE STACK_SIZE / 8
#else
diff --git a/gcc/testsuite/gcc.c-torture/execute/20011008-3.c b/gcc/testsuite/gcc.c-torture/execute/20011008-3.c
index 3244b0a..2fd6871 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20011008-3.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20011008-3.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
extern void exit (int);
extern void abort (void);
diff --git a/gcc/testsuite/gcc.c-torture/execute/20030209-1.c b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c
index 5845d67..72c1e55 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20030209-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifdef STACK_SIZE
#if STACK_SIZE < 8*100*100
#define SKIP
diff --git a/gcc/testsuite/gcc.c-torture/execute/20031012-1.c b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
index a1f3de8..db7f3fa 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20031012-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* PR optimization/8750
Used to fail under Cygwin with
-O2 -fomit-frame-pointer
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c
index f09fc49..4e978f5 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000)
int main () { exit (0); }
#else
diff --git a/gcc/testsuite/gcc.c-torture/execute/920410-1.c b/gcc/testsuite/gcc.c-torture/execute/920410-1.c
index f5180f0..50bc417 100644
--- a/gcc/testsuite/gcc.c-torture/execute/920410-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/920410-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (40000 * 4 + 256)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
diff --git a/gcc/testsuite/gcc.c-torture/execute/920501-7.c b/gcc/testsuite/gcc.c-torture/execute/920501-7.c
index d05ac61..5cced09 100644
--- a/gcc/testsuite/gcc.c-torture/execute/920501-7.c
+++ b/gcc/testsuite/gcc.c-torture/execute/920501-7.c
@@ -1,5 +1,6 @@
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1)
diff --git a/gcc/testsuite/gcc.c-torture/execute/921113-1.c b/gcc/testsuite/gcc.c-torture/execute/921113-1.c
index 78972bc..24c4952 100644
--- a/gcc/testsuite/gcc.c-torture/execute/921113-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/921113-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (128 * 128 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
diff --git a/gcc/testsuite/gcc.c-torture/execute/921202-1.c b/gcc/testsuite/gcc.c-torture/execute/921202-1.c
index 935975d..530fad0 100644
--- a/gcc/testsuite/gcc.c-torture/execute/921202-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/921202-1.c
@@ -1,4 +1,6 @@
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#ifndef STACK_SIZE
#define VLEN 2055
#else
diff --git a/gcc/testsuite/gcc.c-torture/execute/921208-2.c b/gcc/testsuite/gcc.c-torture/execute/921208-2.c
index f01b572..f18f2c8 100644
--- a/gcc/testsuite/gcc.c-torture/execute/921208-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/921208-2.c
@@ -1,4 +1,6 @@
/* { dg-require-effective-target untyped_assembly } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#define STACK_REQUIREMENT (100000 * 4 + 1024)
#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT
main () { exit (0); }
diff --git a/gcc/testsuite/gcc.c-torture/execute/930106-1.c b/gcc/testsuite/gcc.c-torture/execute/930106-1.c
index 8081f92..41add7d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/930106-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/930106-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#if defined (STACK_SIZE)
#define DUMMY_SIZE 9
#else
diff --git a/gcc/testsuite/gcc.c-torture/execute/930406-1.c b/gcc/testsuite/gcc.c-torture/execute/930406-1.c
index 9728eab..0d6b0fb 100644
--- a/gcc/testsuite/gcc.c-torture/execute/930406-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/930406-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
f()
{
int x = 1;
diff --git a/gcc/testsuite/gcc.c-torture/execute/950221-1.c b/gcc/testsuite/gcc.c-torture/execute/950221-1.c
index d67da5b..aa71024 100644
--- a/gcc/testsuite/gcc.c-torture/execute/950221-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/950221-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
struct parsefile
{
long fd;
diff --git a/gcc/testsuite/gcc.c-torture/execute/960521-1.c b/gcc/testsuite/gcc.c-torture/execute/960521-1.c
index 9fc5821..fc69ff9 100644
--- a/gcc/testsuite/gcc.c-torture/execute/960521-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/960521-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdlib.h>
int *a, *b;
diff --git a/gcc/testsuite/gcc.c-torture/execute/980605-1.c b/gcc/testsuite/gcc.c-torture/execute/980605-1.c
index 2fc2691..9185f2b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/980605-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/980605-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdio.h>
#ifndef STACK_SIZE
diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c
index d01f96b..3bc00ef 100644
--- a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c
@@ -1,4 +1,5 @@
/* { dg-require-effective-target label_values } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
index eaf83d8..21a1e6f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-2.c
@@ -1,5 +1,6 @@
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
/* A slight variation of 920501-7.c. */
diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c
index 684854b..e94ab8a 100644
--- a/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <string.h>
#if defined (STACK_SIZE)
diff --git a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
index 377f08c..8ab041b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
+++ b/gcc/testsuite/gcc.c-torture/execute/multi-ix.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Test for a reload bug:
if you have a memory reference using the indexed addressing
mode, and the base address is a pseudo containing an address in the frame
diff --git a/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c
index e028166..ee5b376 100644
--- a/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c
+++ b/gcc/testsuite/gcc.c-torture/execute/nestfunc-4.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Origin: hp@bitrange.com
Test that return values come out right from a 1000-level call chain to
functions without parameters that each need at least one "long"
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c
index 57b3df7..4a55c97 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* When generating o32 MIPS PIC, main's $gp save slot was out of range
of a single load instruction. */
struct big { int i[sizeof (int) >= 4 && sizeof (void *) >= 4 ? 0x4000 : 4]; };
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23135.c b/gcc/testsuite/gcc.c-torture/execute/pr23135.c
index 378ebe7..31b4f8f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr23135.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr23135.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Based on execute/simd-1.c, modified by joern.rennecke@st.com to
trigger a reload bug. Verified for gcc mainline from 20050722 13:00 UTC
for sh-elf -m4 -O2. */
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28982b.c b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c
index 3f9f5ba..90d4a93 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr28982b.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* Like pr28982a.c, but with the spill slots outside the range of
a single sp-based load on ARM. This test tests for cases where
the addresses in the base and index reloads require further reloads. */
diff --git a/gcc/testsuite/gcc.dg/loop-3.c b/gcc/testsuite/gcc.dg/loop-3.c
index 6bdb5ef..2c500d0 100644
--- a/gcc/testsuite/gcc.dg/loop-3.c
+++ b/gcc/testsuite/gcc.dg/loop-3.c
@@ -4,6 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-O3" } */
/* { dg-options "-O3 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
# define BYTEMEM_SIZE 10000L
diff --git a/gcc/testsuite/gcc.dg/struct-ret-3.c b/gcc/testsuite/gcc.dg/struct-ret-3.c
index 36cc87e..c6f87ac 100644
--- a/gcc/testsuite/gcc.dg/struct-ret-3.c
+++ b/gcc/testsuite/gcc.dg/struct-ret-3.c
@@ -2,7 +2,8 @@
/* Origin: Peeter Joot <peeterj@ca.ibm.com> */
/* { dg-do run { target *-*-linux* *-*-gnu* } } */
-
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c
index 98a47a8..726bb20 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/comp-goto-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
#ifdef STACK_SIZE
#define DEPTH ((STACK_SIZE) / 512 + 1)
diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c
index 591428d..90ca71c 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-4.c
@@ -2,6 +2,7 @@
/* { dg-require-effective-target nonlocal_goto } */
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
extern void abort (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c b/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c
index 86e88ad..dd6774f 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c
@@ -1,6 +1,8 @@
/* { dg-require-effective-target freorder } */
/* { dg-require-effective-target label_values } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
#include <stdlib.h>
#if (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr44777.c b/gcc/testsuite/gcc.dg/tree-prof/pr44777.c
index 4074b75..1249b5b 100644
--- a/gcc/testsuite/gcc.dg/tree-prof/pr44777.c
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr44777.c
@@ -2,6 +2,8 @@
/* { dg-require-effective-target label_values } */
/* { dg-require-effective-target trampolines } */
/* { dg-options "-O0" } */
+/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */
+
/* A variant of gcc.c-torture/execute/comp-goto-2.c. */
extern void abort (void);
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index fd32a30..e4ac239 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -141,9 +141,6 @@ proc gcc_target_compile { source dest type options } {
lappend options "ldflags=$TEST_EXTRA_LIBS"
}
- if [target_info exists gcc,stack_size] {
- lappend options "additional_flags=-DSTACK_SIZE=[target_info gcc,stack_size]"
- }
if [target_info exists gcc,signal_suppress] {
lappend options "additional_flags=-DSIGNAL_SUPPRESS"
}
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index c8b9741..431754f 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -191,10 +191,6 @@ proc objc_target_compile { source dest type options } {
lappend options "ldflags=$wrap_flags"
}
- if [target_info exists objc,stack_size] {
- lappend options "additional_flags=-DSTACK_SIZE=[target_info objc,stack_size]"
- }
-
# TEST_ALWAYS_FLAGS are flags that should be passed to every
# compilation. They are passed first to allow individual
# tests to override them.
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 77ffae0..6519c44 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -248,6 +248,7 @@ proc profopt-get-options { src } {
foreach op $tmp {
set cmd [lindex $op 0]
if { ![string compare "dg-options" $cmd] \
+ || ![string compare "dg-additional-options" $cmd] \
|| ![string compare "dg-skip-if" $cmd] \
|| ![string compare "dg-final-generate" $cmd] \
|| ![string compare "dg-final-use" $cmd] \
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 9c9a26f..d7efc19 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -504,6 +504,27 @@ proc check_effective_target_trampolines { } {
return 1
}
+# Return 1 if target has limited stack size.
+
+proc check_effective_target_stack_size { } {
+ if [target_info exists gcc,stack_size] {
+ return 1
+ }
+ return 0
+}
+
+# Return the value attribute of an effective target, otherwise return 0.
+
+proc dg-effective-target-value { effective_target } {
+ if { "$effective_target" == "stack_size" } {
+ if [check_effective_target_stack_size] {
+ return [target_info gcc,stack_size]
+ }
+ }
+
+ return 0
+}
+
# Return 1 if according to target_info struct and explicit target list
# target disables -fdelete-null-pointer-checks. Targets should return 0
# if they simply default to -fno-delete-null-pointer-checks but obey