public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355
@ 2011-06-11 15:37 H.J. Lu
  2011-06-12 11:00 ` Richard Guenther
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2011-06-11 15:37 UTC (permalink / raw)
  To: gcc-patches

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  <hongjiu.lu@intel.com>

	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 ();
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-14 16:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-11 15:37 PATCH [1/n]: Prepare x32: PR middle-end/47364: internal compiler error: in emit_move_insn, at expr.c:3355 H.J. Lu
2011-06-12 11:00 ` Richard Guenther
2011-06-12 13:35   ` H.J. Lu
2011-06-12 14:33     ` Richard Guenther
2011-06-12 14:54       ` H.J. Lu
2011-06-12 15:01         ` H.J. Lu
2011-06-12 16:41           ` H.J. Lu
2011-06-14 15:22             ` Richard Guenther
2011-06-14 16:53               ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).