[PATCH]: fix conversion of nearbyint/rint -> lrint
Mon Mar 5 15:38:00 GMT 2007
On 3/5/07, Kaveh R. GHAZI <firstname.lastname@example.org> wrote:
> On Mon, 5 Mar 2007, Richard Guenther wrote:
> > > Okay for mainline/4.2/4.1?
> > I think this is not correct, as lrint will get extra exceptions compared
> > to using conversion and rint (the invalid exception in case the result
> > doesn't fit the integer type). It looks like now we are only trying to
> > not remove traps and do not care about introducing more, which is wrong
> > as you noted. I fear the only valid solution is to make both
> > transformations conditional under flag_no_trapping_math.
> > Or am I missing something?
> True, plain rint won't generate FE_INVALID. But we're not converting
> plain rint, we're converting e.g. (long)rint -> lrint.
> AFAICT, the cast-to-long will generate FE_INVALID given an argument that
> doesn't fit into a long. Try it with e.g. DBL_MAX.
Hm, indeed that is what IEC60559 and IEEE754 say. So the patch is ok
If it is a regression, it is also ok for the branches (like, if we
didn't to the transformation
in some ancient gcc).
More information about the Gcc-patches