[RFA]: Fix gcc.c-torture tests for 16-bit targets (HC11/HC12)

Stephane Carrez Stephane.Carrez@worldnet.fr
Sun May 20 04:28:00 GMT 2001


Hi!

There are several tests in GCC testsuite that define arrays larger than 64K.
This fails for 16-bit targets.  I would like to propose the following patch
to solve this.

The size of the arrays is set to smaller values when STACK_SIZE is defined
and small.  They are not changed for others.

Can you approve or integrate this patch in 3_0-branch and mainline?

Thanks,
	Stephane

2001-05-19  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* gcc.c-torture/unsorted/msp.c (A_SIZE): Define according to
	STACK_SIZE;
	* gcc.c-torture/compile/991214-2.c (HISTO_SIZE): Define according
	to STACK_SIZE; Use it to define size of add_histo array.
	* gcc.c-torture/compile/920723-1.c (GITT_SIZE): Define according 
	to STACK_SIZE.
	(f): Use GITT_SIZE to define size of gitt local table.
	* gcc.c-torture/compile/930621-1.c (BYTEMEM_SIZE): Define according 
	to STACK_SIZE; Use it to define size of bytemem array.
Index: gcc.c-torture/compile/920723-1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/compile/920723-1.c,v
retrieving revision 1.2
diff -u -p -r1.2 920723-1.c
--- 920723-1.c	1998/12/16 22:07:25	1.2
+++ 920723-1.c	2001/05/20 08:59:07
@@ -1,3 +1,11 @@
+#if defined(STACK_SIZE) && STACK_SIZE < 65536
+# define GITT_SIZE 75
+#endif
+
+#ifndef GITT_SIZE
+# define GITT_SIZE 150
+#endif
+
 typedef struct {
   double x, y;
 } vector_t;
@@ -6,7 +14,7 @@ f(int count,vector_t*pos,double r,double
 {
   int i, j, miny, maxy, hy;
   float help, d;
-  int gitt[150][150];
+  int gitt[GITT_SIZE][GITT_SIZE];
   int *data = (int *)malloc(count*sizeof(int));
   for (i = 0; i < count; i++)
     rho[i] = 0;
Index: gcc.c-torture/compile/930621-1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/compile/930621-1.c,v
retrieving revision 1.2
diff -u -p -r1.2 930621-1.c
--- 930621-1.c	1998/12/16 22:08:53	1.2
+++ 930621-1.c	2001/05/20 08:59:07
@@ -1,6 +1,14 @@
+#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
+# define BYTEMEM_SIZE 10000L
+#endif
+
+#ifndef BYTEMEM_SIZE
+# define BYTEMEM_SIZE 45000L
+#endif
+
 int bytestart[5000 + 1];
 unsigned char modtext[400 + 1];
-unsigned char bytemem[2][45000L + 1];
+unsigned char bytemem[2][BYTEMEM_SIZE + 1];
 
 long
 modlookup (int l)
Index: gcc.c-torture/compile/991214-2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/compile/991214-2.c,v
retrieving revision 1.1
diff -u -p -r1.1 991214-2.c
--- 991214-2.c	1999/12/14 10:13:57	1.1
+++ 991214-2.c	2001/05/20 08:59:07
@@ -1,3 +1,9 @@
+#if defined(STACK_SIZE) && (STACK_SIZE < 65536)
+# define HISTO_SIZE 9
+#else
+# define HISTO_SIZE 36
+#endif
+
 extern int N;
 extern int nrows;
 extern int or_num_angles;
@@ -8,7 +14,7 @@ typedef struct
   int count;
 }Histo;
 
-Histo add_histo[10][2][36][36];
+Histo add_histo[10][2][HISTO_SIZE][HISTO_SIZE];
 
 void cmd_connection_statistics( )
 {
Index: gcc.c-torture/unsorted/msp.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/testsuite/gcc.c-torture/unsorted/msp.c,v
retrieving revision 1.2
diff -u -p -r1.2 msp.c
--- msp.c	1998/12/16 22:21:09	1.2
+++ msp.c	2001/05/20 08:59:09
@@ -1,5 +1,10 @@
+#ifdef STACK_SIZE
+# define A_SIZE (STACK_SIZE/sizeof(int))
+#else
+# define A_SIZE 16384
+#endif
 foo ()
 {
-  int a[16384];
+  int a[A_SIZE];
   bar (a);
 }


More information about the Gcc-patches mailing list