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] Fix PR middle-end/22429, fold building tree whichdepends on signed overflow


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



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