diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-14 16:31:57 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-14 16:31:57 +0000 |
commit | 499eee580f22ff52f748bf03e215361cdc712e23 (patch) | |
tree | 84db851d1d9699a10ee7a3b9f5df564beb59ed58 /gcc/builtins.c | |
parent | 53f0d830b9b672a941e990dd1512540957692a85 (diff) | |
download | gcc-499eee580f22ff52f748bf03e215361cdc712e23.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175034 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 7b24a0ce703..cf975e578a7 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 (); |