diff options
author | Michael Matz <matz@suse.de> | 2013-07-12 15:41:49 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2013-07-12 15:41:49 +0000 |
commit | 18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9 (patch) | |
tree | 4d63038be796e8fcc6cbc95e125ec2ead6069df9 /gcc/convert.c | |
parent | e4f0f84d56bccc7ffcbf2ba7def8bcc7cb921b6b (diff) | |
download | gcc-18b0ea8fce2dfd832d6a66c8b02bbf0af62502e9.tar.gz |
re PR middle-end/55771 (Negation and type conversion incorrectly exchanged)
PR middle-end/55771
* convert.c (convert_to_real): Reject non-float inner types.
testsuite/
* c-c++-common/pr55771.c: New test.
From-SVN: r200926
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 62ff224b566..9ecef4247ba 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -213,11 +213,12 @@ convert_to_real (tree type, tree expr) switch (TREE_CODE (expr)) { /* Convert (float)-x into -(float)x. This is safe for - round-to-nearest rounding mode. */ + round-to-nearest rounding mode when the inner type is float. */ case ABS_EXPR: case NEGATE_EXPR: if (!flag_rounding_math - && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr))) + && FLOAT_TYPE_P (itype) + && TYPE_PRECISION (type) < TYPE_PRECISION (itype)) return build1 (TREE_CODE (expr), type, fold (convert_to_real (type, TREE_OPERAND (expr, 0)))); |