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] |
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. The checking in convert_to_real is wrong, it compares type precisions of different classed types. The change with the least impact is to reject only TYPE_UNSIGNED inner types, but perhaps it would be better to only do the transformation if the inner type is FLOAT_TYPE_P as well.
If you want to handle integers, shouldn't you test TYPE_OVERFLOW_UNDEFINED (for LONG_MIN)? FLOAT_TYPE_P does seem safer indeed.
I'd replace TREE_TYPE (expr) with itype on the next line, it is confusing to refer to it under 2 different names on 2 consecutive lines.
-- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |