diff options
author | Richard Henderson <rth@redhat.com> | 2001-11-27 01:07:59 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2001-11-27 01:07:59 -0800 |
commit | 188235dff14c855c929b8a52378deaf452637e1a (patch) | |
tree | 28f9117516f744d981eb4db9a1d2d0c8c735ab84 /gcc | |
parent | d99b0e79659d5d303b18a0fcecb55b05bd4aaa83 (diff) | |
download | gcc-188235dff14c855c929b8a52378deaf452637e1a.zip gcc-188235dff14c855c929b8a52378deaf452637e1a.tar.gz gcc-188235dff14c855c929b8a52378deaf452637e1a.tar.bz2 |
ifcvt.c (noce_try_store_flag_constants): Test for overflow in computing DIFF.
* ifcvt.c (noce_try_store_flag_constants): Test for overflow
in computing DIFF.
From-SVN: r47374
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ifcvt.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d60935..ab35538 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-27 Richard Henderson <rth@redhat.com> + + * ifcvt.c (noce_try_store_flag_constants): Test for overflow + in computing DIFF. + 2001-11-27 Zack Weinberg <zack@codesourcery.com> * cppfiles.c (read_include_file): Add comment. diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 5dd42fc..f6a07e9 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) |