From 7ff6bdb7278fcd66b0e2f1d38ed9a31733449f78 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 19 Oct 2017 08:11:26 +0000 Subject: [PATCH] Add dg-require-stack-size 2017-10-19 Tom de Vries * lib/target-supports-dg.exp (dg-require-stack-size): New proc. * gcc.c-torture/execute/20030209-1.c: Use dg-require-stack-size. * gcc.c-torture/execute/20040805-1.c: Same. * gcc.c-torture/execute/920410-1.c: Same. * gcc.c-torture/execute/921113-1.c: Same. * gcc.c-torture/execute/921208-2.c: Same. * gcc.c-torture/execute/comp-goto-1.c: Same. * gcc.c-torture/execute/pr20621-1.c: Same. * gcc.c-torture/execute/pr28982b.c: Same. * gcc.dg/tree-prof/comp-goto-1.c: Same. * doc/sourcebuild.texi (Test Directives, Variants of dg-require-support): Add dg-require-stack-size. From-SVN: r253882 --- gcc/ChangeLog | 5 +++++ gcc/doc/sourcebuild.texi | 3 +++ gcc/testsuite/ChangeLog | 13 +++++++++++++ gcc/testsuite/gcc.c-torture/execute/20030209-1.c | 16 +--------------- gcc/testsuite/gcc.c-torture/execute/20040805-1.c | 4 ++-- gcc/testsuite/gcc.c-torture/execute/920410-1.c | 8 ++------ gcc/testsuite/gcc.c-torture/execute/921113-1.c | 8 +------- gcc/testsuite/gcc.c-torture/execute/921208-2.c | 9 +-------- .../gcc.c-torture/execute/comp-goto-1.c | 4 ++-- gcc/testsuite/gcc.c-torture/execute/pr20621-1.c | 7 ++----- gcc/testsuite/gcc.c-torture/execute/pr28982b.c | 6 +----- gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c | 4 ++-- gcc/testsuite/lib/target-supports-dg.exp | 15 +++++++++++++++ 13 files changed, 50 insertions(+), 52 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7f5b9f4df87..91a29170225 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-10-19 Tom de Vries + + * doc/sourcebuild.texi (Test Directives, Variants of + dg-require-support): Add dg-require-stack-size. + 2017-10-19 Martin Liska PR sanitizer/82517 diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index a2f04291194..7d6d4a381a6 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2358,6 +2358,9 @@ Skip the test if the target does not support the @code{-fstack-check} option. If @var{check} is @code{""}, support for @code{-fstack-check} is checked, for @code{-fstack-check=("@var{check}")} otherwise. +@item dg-require-stack-size @var{size} +Skip the test if the target does not support a stack size of @var{size}. + @item dg-require-visibility @var{vis} Skip the test if the target does not support the @code{visibility} attribute. If @var{vis} is @code{""}, support for @code{visibility("hidden")} is diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a30186a2f49..f48860adb3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2017-10-19 Tom de Vries + + * lib/target-supports-dg.exp (dg-require-stack-size): New proc. + * gcc.c-torture/execute/20030209-1.c: Use dg-require-stack-size. + * gcc.c-torture/execute/20040805-1.c: Same. + * gcc.c-torture/execute/920410-1.c: Same. + * gcc.c-torture/execute/921113-1.c: Same. + * gcc.c-torture/execute/921208-2.c: Same. + * gcc.c-torture/execute/comp-goto-1.c: Same. + * gcc.c-torture/execute/pr20621-1.c: Same. + * gcc.c-torture/execute/pr28982b.c: Same. + * gcc.dg/tree-prof/comp-goto-1.c: Same. + 2017-10-19 Martin Liska PR sanitizer/82517 diff --git a/gcc/testsuite/gcc.c-torture/execute/20030209-1.c b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c index 8f076ecb0c7..52f71ec3543 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20030209-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20030209-1.c @@ -1,12 +1,5 @@ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "8*100*100" } */ -#ifdef STACK_SIZE -#if STACK_SIZE < 8*100*100 -#define SKIP -#endif -#endif - -#ifndef SKIP double x[100][100]; int main () { @@ -18,10 +11,3 @@ int main () abort (); exit (0); } -#else -int -main () -{ - exit (0); -} -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c index d3208d69f9d..f31109266b1 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20040805-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20040805-1.c @@ -1,6 +1,6 @@ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "0x12000" } */ -#if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000) +#if __INT_MAX__ < 32768 int main () { exit (0); } #else int a[2] = { 2, 3 }; diff --git a/gcc/testsuite/gcc.c-torture/execute/920410-1.c b/gcc/testsuite/gcc.c-torture/execute/920410-1.c index 44a72bd7bb5..daeff5e3990 100644 --- a/gcc/testsuite/gcc.c-torture/execute/920410-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/920410-1.c @@ -1,8 +1,4 @@ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "40000 * 4 + 256" } */ -#define STACK_REQUIREMENT (40000 * 4 + 256) -#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT -main () { exit (0); } -#else main(){int d[40000];d[0]=0;exit(0);} -#endif + diff --git a/gcc/testsuite/gcc.c-torture/execute/921113-1.c b/gcc/testsuite/gcc.c-torture/execute/921113-1.c index d3e44e358d2..824e69f04c4 100644 --- a/gcc/testsuite/gcc.c-torture/execute/921113-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/921113-1.c @@ -1,9 +1,4 @@ -/* { dg-add-options stack_size } */ - -#define STACK_REQUIREMENT (128 * 128 * 4 + 1024) -#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT -main () { exit (0); } -#else +/* { dg-require-stack-size "128 * 128 * 4 + 1024" } */ typedef struct { float wsx; @@ -62,4 +57,3 @@ main() exit(0); } -#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/921208-2.c b/gcc/testsuite/gcc.c-torture/execute/921208-2.c index da9ee524924..01e14f8cffe 100644 --- a/gcc/testsuite/gcc.c-torture/execute/921208-2.c +++ b/gcc/testsuite/gcc.c-torture/execute/921208-2.c @@ -1,10 +1,5 @@ /* { dg-require-effective-target untyped_assembly } */ -/* { dg-add-options stack_size } */ - -#define STACK_REQUIREMENT (100000 * 4 + 1024) -#if defined (STACK_SIZE) && STACK_SIZE < STACK_REQUIREMENT -main () { exit (0); } -#else +/* { dg-require-stack-size "100000 * 4 + 1024" } */ g(){} @@ -25,5 +20,3 @@ main () f(); exit(0); } - -#endif 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 2a840521487..4379fe70e9c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/comp-goto-1.c @@ -1,9 +1,9 @@ /* { dg-require-effective-target label_values } */ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "4000" } */ #include -#if (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647 +#if __INT_MAX__ >= 2147483647 typedef unsigned int uint32; typedef signed int sint32; diff --git a/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c index 9d0119b9689..b2a9785cd6f 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr20621-1.c @@ -1,12 +1,9 @@ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "0x10000" } */ /* 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]; }; struct big gb; int foo (struct big b, int x) { return b.i[x]; } -#if defined(STACK_SIZE) && STACK_SIZE <= 0x10000 -int main (void) { return 0; } -#else int main (void) { return foo (gb, 0) + foo (gb, 1); } -#endif + diff --git a/gcc/testsuite/gcc.c-torture/execute/pr28982b.c b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c index f28425e8fd7..b68fa9a7051 100644 --- a/gcc/testsuite/gcc.c-torture/execute/pr28982b.c +++ b/gcc/testsuite/gcc.c-torture/execute/pr28982b.c @@ -1,11 +1,8 @@ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "0x80100" } */ /* 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. */ -#if defined(STACK_SIZE) && STACK_SIZE <= 0x80100 -int main (void) { return 0; } -#else #define NITER 4 #define NVARS 20 #define MULTI(X) \ @@ -57,4 +54,3 @@ main (void) return 1; return 0; } -#endif 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 fe768f9a98d..baed1e3fa78 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/comp-goto-1.c @@ -1,11 +1,11 @@ /* { dg-require-effective-target freorder } */ /* { dg-require-effective-target label_values } */ /* { dg-options "-O2 -freorder-blocks-and-partition" } */ -/* { dg-add-options stack_size } */ +/* { dg-require-stack-size "4000" } */ #include -#if (!defined(STACK_SIZE) || STACK_SIZE >= 4000) && __INT_MAX__ >= 2147483647 +#if __INT_MAX__ >= 2147483647 typedef unsigned int uint32; typedef signed int sint32; diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index d50d8b07ada..6080421fa9e 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -180,6 +180,21 @@ proc dg-require-iconv { args } { } } +# If this target does not have sufficient stack size, skip this test. + +proc dg-require-stack-size { args } { + if { ![is-effective-target stack_size] } { + return + } + + set stack_size [dg-effective-target-value stack_size] + set required [expr [lindex $args 1]] + if { $stack_size < $required } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + # If this target does not support named sections skip this test. proc dg-require-named-sections { args } { -- 2.30.2