summaryrefslogtreecommitdiff
path: root/gcc/ifcvt.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-27 09:07:59 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2001-11-27 09:07:59 +0000
commit7f9adb18c9a3d659023c0d8aa519d8e3d60910c0 (patch)
tree28f9117516f744d981eb4db9a1d2d0c8c735ab84 /gcc/ifcvt.c
parentb1dff56a1ca96e3661899d71b7db3fdffe01c1ca (diff)
downloadgcc-7f9adb18c9a3d659023c0d8aa519d8e3d60910c0.tar.gz
* ifcvt.c (noce_try_store_flag_constants): Test for overflow
in computing DIFF. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r--gcc/ifcvt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 5dd42fc8d7e..f6a07e96670 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -650,6 +650,12 @@ noce_try_store_flag_constants (if_info)
mode = GET_MODE (if_info->x);
ifalse = INTVAL (if_info->a);
itrue = INTVAL (if_info->b);
+
+ /* Make sure we can represent the difference between the two values. */
+ if ((itrue - ifalse > 0)
+ != ((ifalse < 0) != (itrue < 0) ? ifalse < 0 : ifalse < itrue))
+ return FALSE;
+
diff = trunc_int_for_mode (itrue - ifalse, mode);
can_reverse = (reversed_comparison_code (if_info->cond, if_info->jump)