This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Canonicalize comparisons, fix PR26899
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 28 Oct 2006 09:32:48 -0600 (MDT)
- Subject: Re: [PATCH] Canonicalize comparisons, fix PR26899
On Sat, 28 Oct 2006, Richard Guenther wrote:
> > I think there's an potential problem here that you're not checking
> > whether the CST-1 operation overflowed.
>
> The CST +- 1 operation cannot overflow, as it is assured perviously that
> CST is not zero and CST will decrease in magnitude by the constant
> adjustment (otherwise the transformation would be invalid as it might
> introduce undefined overflow).
Doh! My mistake, you're quite right.
> 2006-10-28 Richard Guenther <rguenther@suse.de>
>
> PR middle-end/26899
> * fold-const.c (maybe_canonicalize_comparison_1): Helper
> for maybe_canonicalize_comparison.
> (maybe_canonicalize_comparison): New function for canonicalizing
> comparison trees.
> (fold_comparison): Call it to canonicalize comparisons with
> constants involved.
>
> * gcc.dg/tree-ssa/pr26899.c: New testcase.
This is OK for mainline. Thanks for the clean-up, and my apologies again
for missing that it was the magnitude of the constant you're reducing/
canonicalizing.
Roger
--