This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/55771] Negation and type conversion incorrectly exchanged
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 21 Dec 2012 13:55:41 +0000
- Subject: [Bug middle-end/55771] Negation and type conversion incorrectly exchanged
- Auto-submitted: auto-generated
- References: <bug-55771-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55771
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-21 13:55:41 UTC ---
Or rather convert.c:convert_to_real:
/* Propagate the cast into the operation. */
if (itype != type && FLOAT_TYPE_P (type))
switch (TREE_CODE (expr))
{
/* Convert (float)-x into -(float)x. This is safe for
round-to-nearest rounding mode. */
case ABS_EXPR:
case NEGATE_EXPR:
if (!flag_rounding_math
&& TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr)))
return build1 (TREE_CODE (expr), type,
fold (convert_to_real (type,
TREE_OPERAND (expr, 0))));
break;
that's of course not valid for unsigned x, even when using ufloat, as the
float result is always signed.