diff options
author | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-12 15:41:49 +0000 |
---|---|---|
committer | matz <matz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-12 15:41:49 +0000 |
commit | 0dc99c85ab5d64d9df3244ba25f0d52c41654d5a (patch) | |
tree | 4d63038be796e8fcc6cbc95e125ec2ead6069df9 /gcc/convert.c | |
parent | 8458c9e9352e2a6695f24cee1948237d77a4df75 (diff) | |
download | gcc-0dc99c85ab5d64d9df3244ba25f0d52c41654d5a.tar.gz |
PR middle-end/55771
* convert.c (convert_to_real): Reject non-float inner types.
testsuite/
* c-c++-common/pr55771.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200926 138bc75d-0d04-0410-961f-82ee72b054a4
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)))); |