From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13263 invoked by alias); 12 Jun 2011 10:49:04 -0000 Received: (qmail 13255 invoked by uid 22791); 12 Jun 2011 10:49:03 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 12 Jun 2011 10:48:49 +0000 Received: by wwf26 with SMTP id 26so3613632wwf.8 for ; Sun, 12 Jun 2011 03:48:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.169.139 with SMTP id z11mr3895331wby.60.1307875728526; Sun, 12 Jun 2011 03:48:48 -0700 (PDT) Received: by 10.227.28.69 with HTTP; Sun, 12 Jun 2011 03:48:48 -0700 (PDT) In-Reply-To: <20110611150953.GA18253@intel.com> References: <20110611150953.GA18253@intel.com> Date: Sun, 12 Jun 2011 11:00:00 -0000 Message-ID: Subject: Re: PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355 From: Richard Guenther To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00933.txt.bz2 On Sat, Jun 11, 2011 at 5:09 PM, H.J. Lu wrote: > Hi, > > expand_builtin_strlen has > > src_reg =3D gen_reg_rtx (Pmode); > ... > pat =3D expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); > if (pat !=3D src_reg) > =A0emit_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. =A0OK for trunk? > > Thanks. > > > H.J. > --- > 2011-06-11 =A0H.J. Lu =A0 > > =A0 =A0 =A0 =A0PR middle-end/47364 > =A0 =A0 =A0 =A0* builtins.c (expand_builtin_strlen): Properly handle targ= et > =A0 =A0 =A0 =A0not 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, > =A0 =A0 =A0 start_sequence (); > =A0 =A0 =A0 pat =3D expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL); > =A0 =A0 =A0 if (pat !=3D src_reg) > - =A0 =A0 =A0 emit_move_insn (src_reg, pat); > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 if (GET_MODE (pat) !=3D Pmode) > + =A0 =A0 =A0 =A0 =A0 pat =3D convert_to_mode (Pmode, pat, 1); Shouldn't this be POINTERS_EXTEND_UNSIGNED instead of 1? > + =A0 =A0 =A0 =A0 emit_move_insn (src_reg, pat); Why not use convert_move unconditionally? Or, why not expand src in Pmode from the start? After all, src_reg is created as Pmode reg. Richard. > + =A0 =A0 =A0 } > =A0 =A0 =A0 pat =3D get_insns (); > =A0 =A0 =A0 end_sequence (); > >