From patchwork Tue Apr 26 22:26:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaz Kojima X-Patchwork-Id: 92969 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 F2BECB6F0C for ; Wed, 27 Apr 2011 08:27:15 +1000 (EST) Received: (qmail 28933 invoked by alias); 26 Apr 2011 22:27:14 -0000 Received: (qmail 28925 invoked by uid 22791); 26 Apr 2011 22:27:13 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mo11.iij4u.or.jp (HELO mo.iij4u.or.jp) (210.138.174.79) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Apr 2011 22:26:58 +0000 Received: by mo.iij4u.or.jp (mo11) id p3QMQuFP025312; Wed, 27 Apr 2011 07:26:57 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox10) id p3QMQp09010743; Wed, 27 Apr 2011 07:26:56 +0900 Date: Wed, 27 Apr 2011 07:26:50 +0900 (JST) Message-Id: <20110427.072650.318057926.kkojima@rr.iij4u.or.jp> To: gcc-patches@gcc.gnu.org Subject: [PATCH Commitred] Fix PR target/48767 From: Kaz Kojima Mime-Version: 1.0 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 Hi, The attached target specific patch is to fix PR target/48767. In the problematic case, sh.c:sh_gimplify_va_arg_expr calls targetm.calls.must_pass_in_stack with void type as its 2nd argument which is unexpected by the callee. The patch is tested on sh4-unknown-linux-gnu with no new failures. Applied on trunk. Regards, kaz --- 2011-04-26 Kaz Kojima PR target/48767 * config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call targetm.calls.must_pass_in_stack for void type. --- ORIG/trunk/gcc/config/sh/sh.c 2011-04-23 09:43:19.000000000 +0900 +++ trunk/gcc/config/sh/sh.c 2011-04-26 10:40:25.000000000 +0900 @@ -8062,9 +8062,14 @@ sh_gimplify_va_arg_expr (tree valist, tr HOST_WIDE_INT size, rsize; tree tmp, pptr_type_node; tree addr, lab_over = NULL, result = NULL; - int pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type); + bool pass_by_ref; tree eff_type; + if (!VOID_TYPE_P (type)) + pass_by_ref = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type); + else + pass_by_ref = false; + if (pass_by_ref) type = build_pointer_type (type);