This is the mail archive of the 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] New fold_range_test optimizations (take 2)

On Thu, 17 Jun 2004, Jakub Jelinek wrote:
> 2004-06-17  Jakub Jelinek  <>
> 	* fold-const.c (build_range_check): If !in_p and recursive call
> 	fails, exit immediately.  If high - low overflows and etype is
> 	a signed type, retry with unsigned etype.
> 	(merge_ranges): If !in0_p and !in1_p, handle even range2 adjacent
> 	to range1 at TYPE_MAX_VALUE and TYPE_MIN_VALUE.
> 	* gcc.dg/range-test-1.c: New test.

This is OK for mainline.  If its no trouble, could you add an extra
sentence to the comment above build_range_check mentioning that this
function can return NULL_TREE (all the callers check for a zero result,
but this isn't described in the function's documentation).

Thanks also to Alex for catching the INT_MAX + 1 != INT_MIN issue,
presumably for types narrower than their mode.  With those changes
it looks like your use of lang_hooks.types.unsigned_type is safe
even when the C++ front-end returns a "utype" of different width to
the original "etype", such that fold_convert performs an implicit
sign extension, c.f. PR middle-end/15069 and


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