From d10a61fbe8a35256164aca7a9a7a51d16cc57370 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 4 Mar 2015 22:33:41 +0000 Subject: [PATCH] fold-const.c (round_up_loc): Cast divisor to signed on all paths before negating it. * fold-const.c (round_up_loc): Cast divisor to signed on all paths before negating it. * stor-layout.c (finalize_record_size): Revert latest change. From-SVN: r221198 --- gcc/ChangeLog | 10 +++++++-- gcc/fold-const.c | 6 ++--- gcc/stor-layout.c | 5 ----- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/entry_queues3.adb | 29 +++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/entry_queues3.adb diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56c844b1266..72760c06723 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-03-04 Eric Botcazou + + * fold-const.c (round_up_loc): Cast divisor to signed on all paths + before negating it. + * stor-layout.c (finalize_record_size): Revert latest change. + 2015-03-04 Andreas Tobler * config/rs6000/t-freebsd64: Remove 32-bit soft-float multilibs. @@ -25,8 +31,8 @@ 2015-03-04 Andreas Krebbel - * gcc/config/s390/s390.c (s390_expand_builtin): Exlude non-htm - builtins from checking for -mhtm option. + * config/s390/s390.c (s390_expand_builtin): Exlude non-htm builtins + from checking for -mhtm option. 2015-03-03 Jan Hubicka diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f9f7f26fd35..0834d47fa03 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -16019,8 +16019,8 @@ round_up_loc (location_t loc, tree value, unsigned int divisor) return value; overflow_p = TREE_OVERFLOW (value); - val &= ~(divisor - 1); - val += divisor; + val += divisor - 1; + val &= - (int) divisor; if (val == 0) overflow_p = true; @@ -16032,7 +16032,7 @@ round_up_loc (location_t loc, tree value, unsigned int divisor) t = build_int_cst (TREE_TYPE (value), divisor - 1); value = size_binop_loc (loc, PLUS_EXPR, value, t); - t = build_int_cst (TREE_TYPE (value), - (HOST_WIDE_INT) divisor); + t = build_int_cst (TREE_TYPE (value), - (int) divisor); value = size_binop_loc (loc, BIT_AND_EXPR, value, t); } } diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 273a12b0cf2..f18f1ac5273 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1627,11 +1627,6 @@ finalize_record_size (record_layout_info rli) unpadded_size_unit = size_binop (PLUS_EXPR, unpadded_size_unit, size_one_node); - if (TREE_CODE (unpadded_size_unit) == INTEGER_CST - && !TREE_OVERFLOW (unpadded_size_unit) - && !valid_constant_size_p (unpadded_size_unit)) - error ("type %qT is too large", rli->t); - /* Round the size up to be a multiple of the required alignment. */ TYPE_SIZE (rli->t) = round_up (unpadded_size, TYPE_ALIGN (rli->t)); TYPE_SIZE_UNIT (rli->t) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2e77ba451ec..a16501a222d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-04 Eric Botcazou + + * gnat.dg/entry_queues3.adb: New test. + 2015-03-04 Ian Lance Taylor * go.test/go-test.exp (go-gc-tests): Skip nilptr test on s390*. diff --git a/gcc/testsuite/gnat.dg/entry_queues3.adb b/gcc/testsuite/gnat.dg/entry_queues3.adb new file mode 100644 index 00000000000..2108163a895 --- /dev/null +++ b/gcc/testsuite/gnat.dg/entry_queues3.adb @@ -0,0 +1,29 @@ +-- { dg-do compile } + +procedure Entry_Queues3 is + + generic + type Large_Range is range <>; + package Queue is + end; + + package body Queue is + task T is + entry E(Large_Range); + end T ; + + task body T is + begin + accept E(Large_Range'First) do + null; + end e ; + end T ; + end Queue; + + type Large_Range is range 0 .. Long_Integer'Last; + + package My_Queue is new Queue(Large_Range); -- { dg-warning "warning" } + +begin + null; +end; -- 2.30.2