diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96da99a..d891f18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed May 3 12:55:46 2000 Jim Wilson <wilson@cygnus.com> + + * fold-const.c (extract_muldiv, case MAX_EXPR): Don't allow signedness + change. + 2000-05-03 Greg McGary <gkm@gnu.org> * tree.h (tree_common): Add bounded_flag member. Remove diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e0d0f00..9568287 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4402,6 +4402,11 @@ extract_muldiv (t, c, code, wide_type) break; case MIN_EXPR: case MAX_EXPR: + /* If widening the type changes the signedness, then we can't perform + this optimization as that changes the result. */ + if (ctype != type && TREE_UNSIGNED (ctype) != TREE_UNSIGNED (type)) + break; + /* MIN (a, b) / 5 -> MIN (a / 5, b / 5) */ if ((t1 = extract_muldiv (op0, c, code, wide_type)) != 0 && (t2 = extract_muldiv (op1, c, code, wide_type)) != 0) |