aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2005-04-17 01:38:24 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-04-17 01:38:24 +0000
commit10dcf221829e724a85e850057a83f5784c8e341b (patch)
tree38e92bac3ceb99b5ed8ffd6a613872242269dbc4 /gcc/builtins.c
parenteee0d85ef565deb74ed052899524bfef0b9d6fd6 (diff)
downloadgcc-10dcf221829e724a85e850057a83f5784c8e341b.zip
gcc-10dcf221829e724a85e850057a83f5784c8e341b.tar.gz
gcc-10dcf221829e724a85e850057a83f5784c8e341b.tar.bz2
re PR middle-end/21024 (fold generates a comparison of two operands whose types do not match)
PR middle-end/21024 * builtins.c (expand_builtin_strcat): Convert the result of strlen to the right type. * fold-const.c (fold_binary) <PLUS_EXPR>: Use fold_convert to avoid creating type mismatches. <GE_EXPR>: Pass op0 and op1 to fold_build2 to avoid creating type mismatches. From-SVN: r98244
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index f39a073..33102e0 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3810,7 +3810,8 @@ expand_builtin_strcat (tree arglist, tree type, rtx target, enum machine_mode mo
fold (build_function_call_expr (strlen_fn,
build_tree_list (NULL_TREE,
dst)));
- /* Create (dst + strlen (dst)). */
+ /* Create (dst + (cast) strlen (dst)). */
+ newdst = fold_convert (TREE_TYPE (dst), newdst);
newdst = fold (build2 (PLUS_EXPR, TREE_TYPE (dst), dst, newdst));
/* Prepend the new dst argument. */