This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Canonicalize comparisons, fix PR26899
On Sat, 28 Oct 2006, Andrew Pinski wrote:
> On Sat, 2006-10-28 at 09:32 -0600, Roger Sayle wrote:
> > 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.
>
>
> And this causes a bootstrap regression, compile the following code at
> -O2:
> extern unsigned short _sch_istable[256];
> __gnat_decode (const char *coded_name, char *ada_name, int verbose)
> {
> int len = strlen (ada_name);
> int n_digits = 0;
> if (len > 1)
> while ((_sch_istable[((int) ada_name[ len - 1 - n_digits]) ] ))
> n_digits++;
> if (ada_name[len - 1 - n_digits] == '$')
> strcat (ada_name, ")");
> }
The following should fix it. Committed as obvious.
2006-10-28 Richard Guenther <rguenther@suse.de>
* fold-const.c (maybe_canonicalize_comparison): Fix code
to match comment.
Index: fold-const.c
===================================================================
*** fold-const.c (revision 118106)
--- fold-const.c (working copy)
*************** maybe_canonicalize_comparison (enum tree
*** 7855,7861 ****
but that causes problems elsewhere. */
if ((flag_wrapv || flag_trapv)
|| (TYPE_UNSIGNED (TREE_TYPE (arg0))
! && !POINTER_TYPE_P (TREE_TYPE (arg0))))
return NULL_TREE;
/* Try canonicalization by simplifying arg0. */
--- 7855,7861 ----
but that causes problems elsewhere. */
if ((flag_wrapv || flag_trapv)
|| (TYPE_UNSIGNED (TREE_TYPE (arg0))
! || POINTER_TYPE_P (TREE_TYPE (arg0))))
return NULL_TREE;
/* Try canonicalization by simplifying arg0. */