diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-23 07:15:45 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-23 07:15:45 +0000 |
commit | 6d9936db60b54ad1f35ca2803b717818a9571e62 (patch) | |
tree | 7d9beeeaa99bee3c5a1fbb22e70da00ea720cc71 /gcc/convert.c | |
parent | dc9682586abad956ec7beac2890a8b741d4b72b1 (diff) | |
download | ppe42-gcc-6d9936db60b54ad1f35ca2803b717818a9571e62.tar.gz ppe42-gcc-6d9936db60b54ad1f35ca2803b717818a9571e62.zip |
2006-10-23 Richard Guenther <rguenther@suse.de>
PR middle-end/21032
* convert.c (convert_to_real): Fold (float)-x to -(float)x
only if not flag_rounding_math.
* gcc.dg/pr21032.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117968 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 118889fad44..0a9743ac8f8 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -248,10 +248,12 @@ convert_to_real (tree type, tree expr) if (itype != type && FLOAT_TYPE_P (type)) switch (TREE_CODE (expr)) { - /* Convert (float)-x into -(float)x. This is always safe. */ + /* Convert (float)-x into -(float)x. This is safe for + round-to-nearest rounding mode. */ case ABS_EXPR: case NEGATE_EXPR: - if (TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (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)))); |