This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR middle-end/22429, fold building tree whichdepends on signed overflow
- From: Jeffrey A Law <law at redhat dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 Jul 2005 13:55:03 -0600
- Subject: Re: [PATCH] Fix PR middle-end/22429, fold building tree whichdepends on signed overflow
- References: <15ed606adbc22d646122f3565ccc6063@physics.uc.edu>
- Reply-to: law at redhat dot com
On Tue, 2005-07-12 at 18:54 -0400, Andrew Pinski wrote:
> The problem here is fold (build_range_check) converts
> "-1073741824 <= n && n <= 1073741823" to "n + 1073741824 >= 0" which
> makes
> depends on signed overflow being defined. Fold later converts it to
> "n >= -1073741824" by my recent patch which is wrong. This patch fixes
> the problem by using unsigned types if signed overflow is undefined.
>
> OK? Bootstrapped and tested on x86_64-pc-linux-gnu with no regressions.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> * fold-const.c (build_range_check): Use unsigned when signed
> overflow is undefined also. If etype is subtype, make sure that
> the subtraction is in the supper type.
I can't convince myself that this patch is either right or wrong.
Clearly something needs to change, but I'm not entirely sure what.
I'd be more comfortable if someone more familiar with this code
could help out. IIRC this is mostly Kenner's code, so maybe he
could chime in on this patch too.
jeff