]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stor-layout.c (layout_type): Use size_binop for array size calculations.
authorRichard Guenther <rguenther@suse.de>
Mon, 5 Sep 2011 09:03:08 +0000 (09:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 5 Sep 2011 09:03:08 +0000 (09:03 +0000)
2011-09-05  Richard Guenther  <rguenther@suse.de>

* stor-layout.c (layout_type): Use size_binop for array size
calculations.

c-family/
* c-common.c (complete_array_type): Use ssize_int (-1) instead
of integer_minus_one_node for empty array upper bounds.

From-SVN: r178526

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/stor-layout.c

index 5a9a33989c96fdf163c76e59e2ab5bfa1f6de8ce..ab05faa1d03e887bb091233c98ae31e53e338668 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-05  Richard Guenther  <rguenther@suse.de>
+
+       * stor-layout.c (layout_type): Use size_binop for array size
+       calculations.
+
 2011-09-05  Georg-Johann Lay  <avr@gjlay.de>
        
        * config/avr/avr.h (progmem_section): Remove Declaration.
index 44eae0810111c9df8f9a3f3cb1d92f391ae355c1..95abde6b7fc35133faee19fb810312ecd0671db1 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-05  Richard Guenther  <rguenther@suse.de>
+
+       * c-common.c (complete_array_type): Use ssize_int (-1) instead
+       of integer_minus_one_node for empty array upper bounds.
+
 2011-08-28  Dodji Seketeli  <dodji@redhat.com>
 
        * c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as
index 4cace8d3b140e04370e6850ff7b91c576892b6ec..9c42d5944da862ef6d8aa044cd8466910ee5b96f 100644 (file)
@@ -8844,7 +8844,7 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
            {
              if (pedantic)
                failure = 3;
-             maxindex = integer_minus_one_node;
+             maxindex = ssize_int (-1);
            }
          else
            {
index f15da0ce30f95dc5bf7c01446ca627ecd4de9a07..359541e02df98a52c2d85c4558bc4374a4bfd8e0 100644 (file)
@@ -1959,16 +1959,15 @@ layout_type (tree type)
            if (integer_zerop (element_size))
              length = size_zero_node;
 
-           /* The computation should happen in the original type so
-              that (possible) negative values are handled appropriately.  */
+           /* The computation should happen in the original signedness so
+              that (possible) negative values are handled appropriately
+              when determining overflow.  */
            else
              length
                = fold_convert (sizetype,
-                               fold_build2 (PLUS_EXPR, TREE_TYPE (lb),
-                                            build_int_cst (TREE_TYPE (lb), 1),
-                                            fold_build2 (MINUS_EXPR,
-                                                         TREE_TYPE (lb),
-                                                         ub, lb)));
+                               size_binop (PLUS_EXPR,
+                                           build_int_cst (TREE_TYPE (lb), 1),
+                                           size_binop (MINUS_EXPR, ub, lb)));
 
            TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
                                           fold_convert (bitsizetype,