diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-27 07:48:37 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-27 07:48:37 +0000 |
commit | 575a3e391a87d31c0adfcd7a76989b974715d1aa (patch) | |
tree | 87f262ea797033d8ac94bd6a964c65a64d14106c /gcc/tree-affine.c | |
parent | 801fdb5cf326105732c03d54e1924bfb71c408f7 (diff) | |
download | gcc-575a3e391a87d31c0adfcd7a76989b974715d1aa.tar.gz |
2013-05-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/57396
* tree-affine.c (double_int_constant_multiple_p): Properly
return false for val == 0 and div != 0.
* gfortran.fortran-torture/execute/pr57396.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199350 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-affine.c')
-rw-r--r-- | gcc/tree-affine.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index 0ee5eaa9db6..46a183a07b4 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -736,11 +736,10 @@ free_affine_expand_cache (struct pointer_map_t **cache) } /* If VAL != CST * DIV for any constant CST, returns false. - Otherwise, if VAL != 0 (and hence CST != 0), and *MULT_SET is true, - additionally compares CST and MULT, and if they are different, - returns false. Finally, if neither of these two cases occur, - true is returned, and if CST != 0, CST is stored to MULT and - MULT_SET is set to true. */ + Otherwise, if *MULT_SET is true, additionally compares CST and MULT, + and if they are different, returns false. Finally, if neither of these + two cases occur, true is returned, and CST is stored to MULT and MULT_SET + is set to true. */ static bool double_int_constant_multiple_p (double_int val, double_int div, @@ -749,7 +748,13 @@ double_int_constant_multiple_p (double_int val, double_int div, double_int rem, cst; if (val.is_zero ()) - return true; + { + if (*mult_set && !mult->is_zero ()) + return false; + *mult_set = true; + *mult = double_int_zero; + return true; + } if (div.is_zero ()) return false; |