From patchwork Tue Aug 10 13:42:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Zhang X-Patchwork-Id: 61380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BAB68B6F0D for ; Tue, 10 Aug 2010 23:42:41 +1000 (EST) Received: (qmail 9196 invoked by alias); 10 Aug 2010 13:42:39 -0000 Received: (qmail 9178 invoked by uid 22791); 10 Aug 2010 13:42:38 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Aug 2010 13:42:32 +0000 Received: (qmail 2465 invoked from network); 10 Aug 2010 13:42:30 -0000 Received: from unknown (HELO ?192.168.1.100?) (jie@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Aug 2010 13:42:30 -0000 Message-ID: <4C61573F.1070400@codesourcery.com> Date: Tue, 10 Aug 2010 21:42:23 +0800 From: Jie Zhang User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: GCC Patches Subject: [testsuite, ARM] Fix gcc.dg/builtin-apply2.c for ARM EABI X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org When testing GCC on a Cortex-M4 board, gcc.dg/builtin-apply2.c will hang the testing. That is because we should not use 64 as the size of the stack argument. For ARM EABI, NAME is passed in r0. D is passed in r2 and r3. E, F and G are passed on stack. So the size of the stack argument data is 20. When using 64, the test will try to access too much data on stack. For Cortex-M4 case, it will access invalid memory region, which causes testing hang. Is it OK? * gcc.dg/builtin-apply2.c (STACK_ARGUMENTS_SIZE): Define to 20 for ARM EABI otherwise 64. (bar): Use STACK_ARGUMENTS_SIZE for the third argument instead of hard coded 64. Index: gcc.dg/builtin-apply2.c =================================================================== --- gcc.dg/builtin-apply2.c (revision 163048) +++ gcc.dg/builtin-apply2.c (working copy) @@ -12,6 +12,15 @@ #define INTEGER_ARG 5 +#ifdef __ARM_EABI__ +/* For ARM EABI, NAME is passed in r0. D is passed in r2 and r3. + E, F and G are passed on stack. So the size of the stack argument + data is 20. */ +#define STACK_ARGUMENTS_SIZE 20 +#else +#define STACK_ARGUMENTS_SIZE 64 +#endif + extern void abort(void); void foo(char *name, double d, double e, double f, int g) @@ -22,7 +31,7 @@ void foo(char *name, double d, double e, void bar(char *name, ...) { - __builtin_apply(foo, __builtin_apply_args(), 64); + __builtin_apply(foo, __builtin_apply_args(), STACK_ARGUMENTS_SIZE); } int main(void)