Re: Fix PR57886, invalid folding of conversion

2013-07-12 Thread Michael Matz
Hi, On Fri, 12 Jul 2013, Marc Glisse wrote: > If you want to handle integers, shouldn't you test TYPE_OVERFLOW_UNDEFINED > (for LONG_MIN)? Right, ... > FLOAT_TYPE_P does seem safer indeed. ... hence this is it now. > > I'd replace TREE_TYPE (expr) with itype on the next line, it is confusing

Re: Fix PR57886, invalid folding of conversion

2013-07-12 Thread Marc Glisse
On Fri, 12 Jul 2013, Michael Matz wrote: GCC happily transforms (float)-z into -(float)z, even when z is of unsigned type (when it's larger than float). That's wrong (the result should always be positive, because -z is). It seems to me that this bug exists in all reasonably recent GCC versions

Re: Fix PR57886, invalid folding of conversion

2013-07-12 Thread Jakub Jelinek
On Fri, Jul 12, 2013 at 03:37:44PM +0200, Michael Matz wrote: > So, this is a dup of PR55771, I'm now proposing to add a test for > FLOAT_TYPE_P, not TYPE_UNSIGNED. Restarted the regstrap. Ok if it passes bootstrap/regtest. I'd say we should apply it to 4.8 too, while it might not be a regressi

Re: Fix PR57886, invalid folding of conversion

2013-07-12 Thread Michael Matz
Hi, On Fri, 12 Jul 2013, Michael Matz wrote: > Hi, > > GCC happily transforms (float)-z into -(float)z, even when z is of > unsigned type (when it's larger than float). That's wrong (the result > should always be positive, because -z is). It seems to me that this bug > exists in all reasona

Fix PR57886, invalid folding of conversion

2013-07-12 Thread Michael Matz
Hi, GCC happily transforms (float)-z into -(float)z, even when z is of unsigned type (when it's larger than float). That's wrong (the result should always be positive, because -z is). It seems to me that this bug exists in all reasonably recent GCC versions. The checking in convert_to_real