From patchwork Thu Sep 30 11:10:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 66145 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 C004DB70A8 for ; Thu, 30 Sep 2010 21:10:33 +1000 (EST) Received: (qmail 17604 invoked by alias); 30 Sep 2010 11:10:27 -0000 Received: (qmail 17542 invoked by uid 22791); 30 Sep 2010 11:10:26 -0000 X-SWARE-Spam-Status: No, hits=-1.8 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; Thu, 30 Sep 2010 11:10:21 +0000 Received: (qmail 18842 invoked from network); 30 Sep 2010 11:10:19 -0000 Received: from unknown (HELO ?192.168.0.100?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Sep 2010 11:10:19 -0000 Message-ID: <4CA47011.4010400@codesourcery.com> Date: Thu, 30 Sep 2010 19:10:09 +0800 From: Yao Qi User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: GCC Patches Subject: [patch, ARM] Fix PR45447 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 We created a struct type for va_list to follow ARM ABI, but TREE_CHAIN (va_list_type) is *not* set properly. This problem causes segmentation fault reported in PR45447. This patch is to address this problem. Regression test for arm-none-linux-gnueabi is still running. OK to trunk/4.5/4.4 if no regression? gcc/ 2010-09-30 Yao Qi PR target/45447 * config/arm/arm.c (arm_build_builtin_va_list): Assign va_list_name to TREE_CHAIN (va_list_type). gcc/testsuite/ 2010-09-30 Yao Qi PR target/45447 * gcc.target/arm/pr45447.c: New test. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 2ff010b..f61006a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1205,6 +1205,7 @@ arm_build_builtin_va_list (void) va_list_type); DECL_ARTIFICIAL (va_list_name) = 1; TYPE_NAME (va_list_type) = va_list_name; + TREE_CHAIN (va_list_type) = va_list_name; /* Create the __ap field. */ ap_field = build_decl (BUILTINS_LOCATION, FIELD_DECL, diff --git a/gcc/testsuite/gcc.target/arm/pr45447.c b/gcc/testsuite/gcc.target/arm/pr45447.c new file mode 100644 index 0000000..cb4a442 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr45447.c @@ -0,0 +1,3 @@ +/* { dg-do compile } */ +/* { dg-options "-g -femit-struct-debug-baseonly" } */ +typedef __builtin_va_list x;