This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]