diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-06 10:36:57 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-06 10:36:57 +0000 |
commit | 30806cf18c1416546da47e9e4fdb23692b37a73c (patch) | |
tree | 96cc7ac4d17db40c43940ec6cf151a6e463c1c0a /gcc/fold-const.c | |
parent | a1b9762a00210b64f90bc9e4599d336fea68b574 (diff) | |
download | gcc-30806cf18c1416546da47e9e4fdb23692b37a73c.tar.gz |
2010-04-06 Richard Guenther <rguenther@suse.de>
PR middle-end/43661
* fold-const.c (fold_comparison): Handle X * 0 CMP 0.
* gcc.c-torture/compile/pr43661.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157984 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 8dd68c2540f..e79d934243d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9576,7 +9576,9 @@ fold_comparison (location_t loc, enum tree_code code, tree type, tree variable1 = TREE_OPERAND (arg0, 0); enum tree_code cmp_code = code; - gcc_assert (!integer_zerop (const1)); + /* Handle unfolded multiplication by zero. */ + if (integer_zerop (const1)) + return fold_build2_loc (loc, cmp_code, type, const1, const2); fold_overflow_warning (("assuming signed overflow does not occur when " "eliminating multiplication in comparison " |