OSDN Git Service

2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
[pf3gnuchains/gcc-fork.git] / gcc / c-common.c
index ccbc479..9bad32d 100644 (file)
@@ -2700,12 +2700,16 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
      Do this multiplication as signed, then convert to the appropriate
      pointer type (actually unsigned integral).  */
 
-  intop = convert (result_type,
-                  build_binary_op (MULT_EXPR, intop,
-                                   convert (TREE_TYPE (intop), size_exp), 1));
+  intop = build_binary_op (MULT_EXPR, intop,
+                          convert (TREE_TYPE (intop), size_exp), 1);
+
+  if (resultcode == MINUS_EXPR)
+    intop = fold_build1 (NEGATE_EXPR, TREE_TYPE (intop), intop);
+
+  intop = convert (sizetype, intop);
 
   /* Create the sum or difference.  */
-  ret = fold_build2 (resultcode, result_type, ptrop, intop);
+  ret = fold_build2 (POINTER_PLUS_EXPR, result_type, ptrop, intop);
 
   fold_undefer_and_ignore_overflow_warnings ();