aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2011-06-14 16:31:57 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2011-06-14 09:31:57 -0700
commitfa4657624c6609bbfffb4ec5fb1e19e44691c864 (patch)
tree84db851d1d9699a10ee7a3b9f5df564beb59ed58 /gcc
parent652de9ffb6a941775908325ad1a057f34fbcfbd5 (diff)
downloadgcc-fa4657624c6609bbfffb4ec5fb1e19e44691c864.zip
gcc-fa4657624c6609bbfffb4ec5fb1e19e44691c864.tar.gz
gcc-fa4657624c6609bbfffb4ec5fb1e19e44691c864.tar.bz2
Properly expand strlen to Pmode.
2011-06-14 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/47364 * builtins.c (expand_builtin_strlen): Expand strlen to Pmode and properly handle result not in Pmode. From-SVN: r175034
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/builtins.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 651f380..56e88cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/47364
+ * builtins.c (expand_builtin_strlen): Expand strlen to Pmode
+ and properly handle result not in Pmode.
+
2011-06-14 Robert Millan <rmh@gnu.org>
* config/i386/kfreebsd-gnu.h: Resync with `config/i386/linux.h'.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 7b24a0c..cf975e5 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2939,9 +2939,16 @@ expand_builtin_strlen (tree exp, rtx target,
/* Now that we are assured of success, expand the source. */
start_sequence ();
- pat = expand_expr (src, src_reg, ptr_mode, EXPAND_NORMAL);
+ pat = expand_expr (src, src_reg, Pmode, EXPAND_NORMAL);
if (pat != src_reg)
- emit_move_insn (src_reg, pat);
+ {
+#ifdef POINTERS_EXTEND_UNSIGNED
+ if (GET_MODE (pat) != Pmode)
+ pat = convert_to_mode (Pmode, pat,
+ POINTERS_EXTEND_UNSIGNED);
+#endif
+ emit_move_insn (src_reg, pat);
+ }
pat = get_insns ();
end_sequence ();