[3/7,MSP430,TESTSUITE] Dynamically check if size_t is large enough for tests containing large structs/arrays
diff mbox series

Message ID 896befd0-f0ee-c7b6-5a9a-a1bfee63eb36@mittosystems.com
State New
Headers show
Series
  • Fix GCC tests for msp430-elf
Related show

Commit Message

Jozef Lawrynowicz Nov. 14, 2018, 3:48 p.m. UTC
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.

Comments

Mike Stump Nov. 26, 2018, 8:15 p.m. UTC | #1
On Nov 14, 2018, at 7:48 AM, Jozef Lawrynowicz <jozef.l@mittosystems.com> wrote:
> 
> Patch 3 sets up require-effective-target directives for tests which
> require the compilation of large arrays.

Ok.

Patch
diff mbox series

From 23ab77f7e44e104595adb0b5cabd9caf93141ffd Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Thu, 8 Nov 2018 22:39:12 +0000
Subject: [PATCH 3/7] [TESTSUITE] Dynamically check if size_t is large enough
 for tests containing large structs/arrays

2018-11-14  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	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/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 +++++++++++++++---
 20 files changed, 45 insertions(+), 20 deletions(-)

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 093b12a..5235d5e 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 size32plus 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