This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH,TESTSUITE]Reduce malloc size used by ipa-sra-2.c


Its the array size:

int data[1000000]

Yes, I could equally skip this.


Richard Guenther wrote:
On Sat, Oct 31, 2009 at 8:27 PM, Andrew Hutchinson
<andrewhutchinson@cox.net> wrote:
Thanks - patch was not as tested. Correction below.

This patch corrects a testcase where malloc size 1,000,000 is way too big
for target.
Size requested is reduce if stack size is below 16000.

The patch removes failures for AVR target.
Ok to commit?

I think for this kind of tests you should simply skip AVR. Note that it mallocs sizeof (struct small), which is small. So I don't see why you get a failure here anyway.

Richard.

2009-10-31 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>

*gcc.c-torture/execute/ipa-sra-2.c: Reduce allocation if stack is small.



Index: ipa-sra-2.c
===================================================================
--- ipa-sra-2.c    (revision 153773)
+++ ipa-sra-2.c    (working copy)
@@ -1,6 +1,11 @@
+#if defined(STACK_SIZE) && STACK_SIZE < 16000
+#define ARRAY_SIZE (STACK_SIZE)
+#else
+#define ARRAY_SIZE 1000000
+#endif
struct big
{
-  int data[1000000];
+  int data[ARRAY_SIZE];
};

struct small
@@ -23,7 +28,7 @@
{
 int r;
 if (fail)
-    r = agg->big.data[999999];
+    r = agg->big.data[ARRAY_SIZE - 1];
 else
   r = agg->small.data[0];
 return r;





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]