From 0069a009910c4d8d3d95db6a3760abd0580f4183 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sat, 10 Jun 2017 06:59:26 +0000 Subject: [PATCH] Add effective target stack_size 2017-06-10 Tom de Vries * 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= 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 --- gcc/ChangeLog | 5 ++ gcc/doc/sourcebuild.texi | 7 +++ gcc/testsuite/ChangeLog | 47 +++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C | 1 + .../gcc.c-torture/compile/20080806-1.c | 2 + .../gcc.c-torture/compile/920723-1.c | 1 + .../gcc.c-torture/compile/930621-1.c | 2 + .../gcc.c-torture/compile/991214-2.c | 2 + gcc/testsuite/gcc.c-torture/compile/bcopy.c | 2 + gcc/testsuite/gcc.c-torture/compile/memtst.c | 2 + gcc/testsuite/gcc.c-torture/compile/msp.c | 2 + gcc/testsuite/gcc.c-torture/compile/stuct.c | 2 + .../gcc.c-torture/execute/20011008-3.c | 2 + .../gcc.c-torture/execute/20030209-1.c | 2 + .../gcc.c-torture/execute/20031012-1.c | 2 + .../gcc.c-torture/execute/20040805-1.c | 2 + .../gcc.c-torture/execute/920410-1.c | 2 + .../gcc.c-torture/execute/920501-7.c | 1 + .../gcc.c-torture/execute/921113-1.c | 2 + .../gcc.c-torture/execute/921202-1.c | 2 + .../gcc.c-torture/execute/921208-2.c | 2 + .../gcc.c-torture/execute/930106-1.c | 2 + .../gcc.c-torture/execute/930406-1.c | 2 + .../gcc.c-torture/execute/950221-1.c | 2 + .../gcc.c-torture/execute/960521-1.c | 2 + .../gcc.c-torture/execute/980605-1.c | 2 + .../gcc.c-torture/execute/comp-goto-1.c | 1 + .../gcc.c-torture/execute/comp-goto-2.c | 1 + .../gcc.c-torture/execute/memcpy-1.c | 2 + .../gcc.c-torture/execute/multi-ix.c | 2 + .../gcc.c-torture/execute/nestfunc-4.c | 2 + .../gcc.c-torture/execute/pr20621-1.c | 2 + gcc/testsuite/gcc.c-torture/execute/pr23135.c | 2 + .../gcc.c-torture/execute/pr28982b.c | 2 + gcc/testsuite/gcc.dg/loop-3.c | 1 + gcc/testsuite/gcc.dg/struct-ret-3.c | 3 +- .../gcc.dg/torture/stackalign/comp-goto-1.c | 1 + .../torture/stackalign/non-local-goto-4.c | 1 + gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c | 2 + gcc/testsuite/gcc.dg/tree-prof/pr44777.c | 2 + gcc/testsuite/lib/gcc.exp | 3 -- gcc/testsuite/lib/objc.exp | 4 -- gcc/testsuite/lib/profopt.exp | 1 + gcc/testsuite/lib/target-supports.exp | 21 +++++++++ 44 files changed, 147 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ab6f8a168a..99c54d1299d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-10 Tom de Vries + + * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes): + Document effective target stack_size. + 2017-06-09 David Malcolm * diagnostic.c (diagnostic_report_diagnostic): Only add fixits diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 841e75abbd8..cdb3a2c883d 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 cc36d7a35b6..7ffa0c0e634 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,50 @@ +2017-06-10 Tom de Vries + + * 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= 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 * 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 31c7300c90b..f63d5c63e4a 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 diff --git a/gcc/testsuite/gcc.c-torture/compile/20080806-1.c b/gcc/testsuite/gcc.c-torture/compile/20080806-1.c index c54e7397f5d..d0ee9cc2e6c 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 69b031e895d..c6351c37261 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 4199bbe0870..13e997a49cc 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 3e18d215e13..32dad4ff864 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 aed994e578a..cb7c05dda01 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 b5ef2607073..e165a2297e8 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 5d350fd5ee0..594cecb6721 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 deb838d8099..59acd571ba6 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 3244b0a97ae..2fd6871e757 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 5845d67b3ca..72c1e55f88b 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 a1f3de8baef..db7f3fa97ad 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 f09fc49a268..4e978f519bc 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 f5180f06a9c..50bc41770e8 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 d05ac61d48c..5cced09dc04 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 78972bc975e..24c4952279a 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 935975dd3ad..530fad006fe 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 f01b5728ee5..f18f2c8faaa 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 8081f926013..41add7dc25d 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 9728eabd7ed..0d6b0fbc948 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 d67da5b0c8c..aa71024b2db 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 9fc5821495a..fc69ff92414 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 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 2fc2691e535..9185f2b9a3c 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 #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 d01f96ba70a..3bc00ef9a9c 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 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 eaf83d870a1..21a1e6f2ae2 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 684854b66dc..e94ab8aad88 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 #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 377f08c115c..8ab041b4a53 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 e028166b608..ee5b376f9b8 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 57b3df764b7..4a55c970b86 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 378ebe741d9..31b4f8f9c14 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 3f9f5bafce5..90d4a931ab8 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 6bdb5ef5697..2c500d02217 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 36cc87e7d0e..c6f87acba9d 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 */ /* { dg-do run { target *-*-linux* *-*-gnu* } } */ - +/* { dg-additional-options "-DSTACK_SIZE=[dg-effective-target-value stack_size]" { target { stack_size } } } */ + #include #include #include 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 98a47a8ce96..726bb209a94 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 591428d08b7..90ca71c9e2d 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 86e88adb89d..dd6774f2826 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 #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 4074b750645..1249b5b251d 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 fd32a30fdf6..e4ac239e418 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 c8b9741eeda..431754f65b3 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 77ffae0267f..6519c44ce33 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 9c9a26fe1dc..d7efc19c018 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 -- 2.30.2