This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,TESTSUITE]Reduce malloc size used by ipa-sra-2.c
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Andrew Hutchinson <andrewhutchinson at cox dot net>
- Cc: gcc-patches at gcc dot gnu dot org, janis187 at us dot ibm dot com, gerald at pfeifer dot com
- Date: Sun, 1 Nov 2009 11:12:25 +0100
- Subject: Re: [PATCH,TESTSUITE]Reduce malloc size used by ipa-sra-2.c
- References: <4AEC83AC.3020401@cox.net> <4AEC8F9B.8080303@cox.net>
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;
>
>