aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-10-28 14:54:48 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-10-28 14:54:48 -0400
commitd90ec4f2bc82f513821be7054b1eeb5c200e81af (patch)
tree635b63931eff5f7c9588deaa1ee992fb3b36ee91 /gcc/c-family
parenta6392fdc0b4210929c40be82e93184a20dba2766 (diff)
downloadgcc-d90ec4f2bc82f513821be7054b1eeb5c200e81af.zip
gcc-d90ec4f2bc82f513821be7054b1eeb5c200e81af.tar.gz
gcc-d90ec4f2bc82f513821be7054b1eeb5c200e81af.tar.bz2
* c-common.c (pointer_int_sum): Fold the MULT_EXPR.
From-SVN: r229500
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c-common.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 4d22572..fb017fa 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-28 Jason Merrill <jason@redhat.com>
+
+ * c-common.c (pointer_int_sum): Fold the MULT_EXPR.
+
2015-10-27 Thomas Schwinge <thomas@codesourcery.com>
James Norris <jnorris@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 1c75921..f957018 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4849,9 +4849,8 @@ pointer_int_sum (location_t loc, enum tree_code resultcode,
for the pointer operation and disregard an overflow that occurred only
because of the sign-extension change in the latter conversion. */
{
- tree t = build_binary_op (loc,
- MULT_EXPR, intop,
- convert (TREE_TYPE (intop), size_exp), 1);
+ tree t = fold_build2_loc (loc, MULT_EXPR, TREE_TYPE (intop), intop,
+ convert (TREE_TYPE (intop), size_exp));
intop = convert (sizetype, t);
if (TREE_OVERFLOW_P (intop) && !TREE_OVERFLOW (t))
intop = wide_int_to_tree (TREE_TYPE (intop), intop);