diff options
author | Richard Guenther <rguenth@gcc.gnu.org> | 2005-06-01 09:34:15 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-06-01 09:34:15 +0000 |
commit | d699d76aa7164b8125ef629d8bceac5f20cc0918 (patch) | |
tree | 4ae0a84079f09d7454efc104f6c1b5ab32c8508c /gcc | |
parent | d006f5eb56135d6130498994fd6e82c1198eb5e1 (diff) | |
download | gcc-d699d76aa7164b8125ef629d8bceac5f20cc0918.zip gcc-d699d76aa7164b8125ef629d8bceac5f20cc0918.tar.gz gcc-d699d76aa7164b8125ef629d8bceac5f20cc0918.tar.bz2 |
fold-const.c (fold_binary): Fix types in strlen vs.
2005-06-01 Richard Guenther <rguenth@gcc.gnu.org>
* fold-const.c (fold_binary): Fix types in strlen vs.
zero comparison folding.
From-SVN: r100436
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b706552..c906a25 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-06-01 Richard Guenther <rguenth@gcc.gnu.org> + + * fold-const.c (fold_binary): Fix types in strlen vs. + zero comparison folding. + 2005-06-01 Richard Henderson <rth@redhat.com> * configure.ac (HAVE_AS_JSRDIRECT_RELOCS): New. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 97caf15..18e92e2 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9915,11 +9915,11 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && (arglist = TREE_OPERAND (arg0, 1)) && TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) == POINTER_TYPE && ! TREE_CHAIN (arglist)) - return fold_build2 (code, type, - build1 (INDIRECT_REF, char_type_node, - TREE_VALUE (arglist)), - fold_convert (char_type_node, - integer_zero_node)); + { + tree iref = build_fold_indirect_ref (TREE_VALUE (arglist)); + return fold_build2 (code, type, iref, + build_int_cst (TREE_TYPE (iref), 0)); + } } /* We can fold X/C1 op C2 where C1 and C2 are integer constants |