From patchwork Sat Jun 11 15:09:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 100013 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 67399B7071 for ; Sun, 12 Jun 2011 01:10:18 +1000 (EST) Received: (qmail 20845 invoked by alias); 11 Jun 2011 15:10:12 -0000 Received: (qmail 20833 invoked by uid 22791); 11 Jun 2011 15:10:11 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Jun 2011 15:09:57 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 11 Jun 2011 08:09:57 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga002.fm.intel.com with ESMTP; 11 Jun 2011 08:09:57 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id EC060C2266; Sat, 11 Jun 2011 08:09:53 -0700 (PDT) Date: Sat, 11 Jun 2011 08:09:53 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355 Message-ID: <20110611150953.GA18253@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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, expand_builtin_strlen has src_reg = gen_reg_rtx (Pmode); ... pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); if (pat != src_reg) emit_move_insn (src_reg, pat); But src_reg may be in ptr_mode, wich may not be the same as Pmode. This patch checks it. OK for trunk? Thanks. H.J. --- 2011-06-11 H.J. Lu PR middle-end/47364 * builtins.c (expand_builtin_strlen): Properly handle target not in Pmode. diff --git a/gcc/builtins.c b/gcc/builtins.c index 7b24a0c..4e2cf31 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2941,7 +2941,11 @@ expand_builtin_strlen (tree exp, rtx target, start_sequence (); pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); if (pat != src_reg) - emit_move_insn (src_reg, pat); + { + if (GET_MODE (pat) != Pmode) + pat = convert_to_mode (Pmode, pat, 1); + emit_move_insn (src_reg, pat); + } pat = get_insns (); end_sequence ();