On Wed, 14 Nov 2018 15:41:00 +0000 Jozef Lawrynowicz <joze...@mittosystems.com> wrote:
> Patch 3 sets up require-effective-target directives for tests which > require the compilation of large arrays. > Targets which have 16-bit or 20-bit size_t fail to compile tests with large > arrays designed to test 32-bit or 64-bit behaviour. Rather than enumerating > another target to skip, I've replaced the target selector in some tests with > a size checking procedure: > - size20plus (new) > - size32plus > size20plus checks to see if a 16-bit structure/array size is supported, > similarly to how the existing size32plus checks to see if a 24-bit > structure/array size is supported, Added missing documentation for new check_effective target procs in attached patch.
>From 1573a8392605a17e58c74be19ee5eb28950dc32d Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz <joze...@mittosystems.com> Date: Thu, 8 Nov 2018 22:39:12 +0000 Subject: [PATCH] [TESTSUITE] Dynamically check if size_t is large enough for tests containing large structs/arrays 2018-11-21 Jozef Lawrynowicz <joze...@mittosystems.com> gcc/ChangeLog: * doc/sourcebuild.texi: Document check_effective_target_size20plus. Clarify documentation for check_effective_target_size32plus. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/20151204.c: Add dg-require-effective-target size20plus. * gcc.dg/pr34225.c: Likewise. * gcc.dg/pr40971.c: Likewise. * gcc.dg/pr69071.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-10.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-2.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-3.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-5.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-6.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-7.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-8.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-9.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-11.c: Add dg-require-effective-target size32plus. * gcc.dg/Walloc-size-larger-than-4.c: Likewise. * gcc.dg/Walloc-size-larger-than-5.c: Likewise. * gcc.dg/Walloc-size-larger-than-6.c: Likewise. * gcc.dg/Walloc-size-larger-than-7.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-1.c: Likewise. * gcc.dg/tree-ssa/loop-interchange-1b.c: Likewise. * lib/target-supports.exp (check_effective_target_size20plus): New. (check_effective_target_size32plus): Update comment. --- gcc/doc/sourcebuild.texi | 7 ++++++- gcc/testsuite/gcc.c-torture/compile/20151204.c | 2 +- gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c | 2 +- gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c | 2 +- gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c | 2 +- gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c | 2 +- gcc/testsuite/gcc.dg/pr34225.c | 1 + gcc/testsuite/gcc.dg/pr40971.c | 1 + gcc/testsuite/gcc.dg/pr69071.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-11.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1b.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-3.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-5.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-6.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-7.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-8.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c | 3 ++- gcc/testsuite/lib/target-supports.exp | 18 +++++++++++++++--- 21 files changed, 51 insertions(+), 21 deletions(-) diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index bca5db3..9c57226 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1375,8 +1375,13 @@ Target supports @code{long double} that is longer than @code{double}. @item ptr32plus Target has pointers that are 32 bits or longer. +@item size20plus +Target has a 20-bit or larger address space, so at least supports +16-bit array and structure sizes. + @item size32plus -Target supports array and structure sizes that are 32 bits or longer. +Target has a 32-bit or larger address space, so at least supports +24-bit array and structure sizes. @item 4byte_wchar_t Target has @code{wchar_t} that is at least 4 bytes. diff --git a/gcc/testsuite/gcc.c-torture/compile/20151204.c b/gcc/testsuite/gcc.c-torture/compile/20151204.c index 6a46abf..e41f6c1 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20151204.c +++ b/gcc/testsuite/gcc.c-torture/compile/20151204.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "Array too big" { "avr-*-*" "pdp11-*-*" } } */ +/* { dg-require-effective-target size20plus } */ typedef __SIZE_TYPE__ size_t; diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c index 4b3a64b..54e43cd 100644 --- a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c +++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c @@ -1,6 +1,6 @@ /* PR middle-end/82063 - issues with arguments enabled by -Wall { dg-do compile } - { dg-skip-if "small address space" { "pdp11-*-*" } } + { dg-require-effective-target size32plus } { dg-options "-O -Walloc-size-larger-than=1MiB -ftrack-macro-expansion=0" } */ void sink (void*); diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c index 4217ad6..774c4cf 100644 --- a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c +++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c @@ -1,6 +1,6 @@ /* PR middle-end/82063 - issues with arguments enabled by -Wall { dg-do compile } - { dg-skip-if "small address space" { "pdp11-*-*" } } + { dg-require-effective-target size32plus } { dg-options "-O -Walloc-size-larger-than=1MB -ftrack-macro-expansion=0" } */ void sink (void*); diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c index a46fce7..2dfc663 100644 --- a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c +++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-6.c @@ -1,6 +1,6 @@ /* PR middle-end/82063 - issues with arguments enabled by -Wall { dg-do compile } - { dg-skip-if "small address space" { "pdp11-*-*" } } + { dg-require-effective-target size32plus } { dg-options "-O -Walloc-size-larger-than=1GiB -ftrack-macro-expansion=0" } */ void sink (void*); diff --git a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c index 4d9aafd..2cc517f 100644 --- a/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c +++ b/gcc/testsuite/gcc.dg/Walloc-size-larger-than-7.c @@ -1,6 +1,6 @@ /* PR middle-end/82063 - issues with arguments enabled by -Wall { dg-do compile } - { dg-skip-if "small address space" { "pdp11-*-*" } } + { dg-require-effective-target size32plus } { dg-options "-O -Walloc-size-larger-than=1GB -ftrack-macro-expansion=0" } */ void sink (void*); diff --git a/gcc/testsuite/gcc.dg/pr34225.c b/gcc/testsuite/gcc.dg/pr34225.c index 659e176..e337340 100644 --- a/gcc/testsuite/gcc.dg/pr34225.c +++ b/gcc/testsuite/gcc.dg/pr34225.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fno-strict-aliasing -fstack-protector" } */ /* { dg-require-effective-target fstack_protector } */ +/* { dg-require-effective-target size20plus } */ typedef __SIZE_TYPE__ size_t; extern int sscanf (const char *, const char *, ...); diff --git a/gcc/testsuite/gcc.dg/pr40971.c b/gcc/testsuite/gcc.dg/pr40971.c index 31dfd5e..4317638 100644 --- a/gcc/testsuite/gcc.dg/pr40971.c +++ b/gcc/testsuite/gcc.dg/pr40971.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-O -fstack-protector -fno-strict-aliasing" } */ /* { dg-require-effective-target fstack_protector } */ +/* { dg-require-effective-target size20plus } */ extern void bar (char *); diff --git a/gcc/testsuite/gcc.dg/pr69071.c b/gcc/testsuite/gcc.dg/pr69071.c index 0396bbc..3ae3811 100644 --- a/gcc/testsuite/gcc.dg/pr69071.c +++ b/gcc/testsuite/gcc.dg/pr69071.c @@ -1,7 +1,7 @@ /* PR target/69071 */ /* { dg-do compile } */ /* { dg-options "-O2 -g" } */ -/* { dg-skip-if "Array too big" { "avr-*-*" } } */ +/* { dg-require-effective-target size20plus } */ void *bar (void *); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1.c index 4a81e12..c7ebaef 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fassociative-math -fno-signed-zeros -fno-trapping-math -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size32plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ /* Copied from graphite/interchange-4.c */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c index 5735756..8f5a9a0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-10.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-11.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-11.c index 2a1b340..413b81e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-11.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-11.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1b.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1b.c index 7de2b40..a3063bb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1b.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-1b.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size32plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ /* Copied from graphite/interchange-4.c */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c index 247adc9..fbd46a2 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ /* Copied from graphite/interchange-5.c */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-3.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-3.c index b239230..8028e36 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-3.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big stack" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big stack" { visium-*-* } } */ /* Copied from graphite/interchange-6.c */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-5.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-5.c index 8f13cd4..81050a8 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-5.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M], c[M][M], d[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-6.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-6.c index a38fd9d..8a2692e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-6.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M], c[M][M], d[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-7.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-7.c index e6ad26f..d55c1e2 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-7.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M], c[M][M], d[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-8.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-8.c index 5ed300a..391b8a4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-8.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M], c[M][M], d[M][M]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c index a984e47..b5fda2d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-9.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ -/* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */ +/* { dg-require-effective-target size20plus } */ +/* { dg-skip-if "too big data segment" { visium-*-* } } */ #define M 256 int a[M][M], b[M][M], c[M], d[M]; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 73f86ee..8a91f79 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2600,9 +2600,21 @@ proc check_effective_target_ptr32plus { } { }] } -# Return 1 if we support 32-bit or larger array and structure sizes -# using default options, 0 otherwise. Avoid false positive on -# targets with 20 or 24 bit address spaces. +# Return 1 if we support 16-bit or larger array and structure sizes +# using default options, 0 otherwise. +# This implies at least a 20-bit address space, as no targets have an address +# space between 16 and 20 bits. + +proc check_effective_target_size20plus { } { + return [check_no_compiler_messages size20plus object { + char dummy[65537L]; + }] +} + +# Return 1 if we support 24-bit or larger array and structure sizes +# using default options, 0 otherwise. +# This implies at least a 32-bit address space, as no targets have an address +# space between 24 and 32 bits. proc check_effective_target_size32plus { } { return [check_no_compiler_messages size32plus object { -- 2.7.4