aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2015-03-04 22:33:41 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-03-04 22:33:41 +0000
commitd10a61fbe8a35256164aca7a9a7a51d16cc57370 (patch)
treebb433524b1c9c0c35778ec90ef3d9c1bdf9ab01f /gcc/fold-const.c
parent8ed4390c3f34ece8009bc43ae592c9f3ed66dcd7 (diff)
downloadgcc-d10a61fbe8a35256164aca7a9a7a51d16cc57370.zip
gcc-d10a61fbe8a35256164aca7a9a7a51d16cc57370.tar.gz
gcc-d10a61fbe8a35256164aca7a9a7a51d16cc57370.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f9f7f26..0834d47 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);
}
}