summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authordalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-05 17:29:41 +0000
committerdalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-10-05 17:29:41 +0000
commitb7ad29391f978cb10d48ec8f8e28dc0b5a95e5f4 (patch)
treeadf749950f317fb0643a322ff56d041135095cf0 /gcc/convert.c
parent94f2a819bc24d2b318cee1c5ca342c21294a2e01 (diff)
downloadgcc-b7ad29391f978cb10d48ec8f8e28dc0b5a95e5f4.tar.gz
2005-10-05 Dale Johannesen <dalej@apple.com>
* convert.c (convert_to_real): Don't convert (float)floor(double d) to floorf((float)d). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105006 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index 5ddae361982..471d93db562 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -200,35 +200,9 @@ convert_to_real (tree type, tree expr)
break;
}
}
- if (optimize
- && (((fcode == BUILT_IN_FLOORL
- || fcode == BUILT_IN_CEILL
- || fcode == BUILT_IN_ROUNDL
- || fcode == BUILT_IN_RINTL
- || fcode == BUILT_IN_TRUNCL
- || fcode == BUILT_IN_NEARBYINTL)
- && (TYPE_MODE (type) == TYPE_MODE (double_type_node)
- || TYPE_MODE (type) == TYPE_MODE (float_type_node)))
- || ((fcode == BUILT_IN_FLOOR
- || fcode == BUILT_IN_CEIL
- || fcode == BUILT_IN_ROUND
- || fcode == BUILT_IN_RINT
- || fcode == BUILT_IN_TRUNC
- || fcode == BUILT_IN_NEARBYINT)
- && (TYPE_MODE (type) == TYPE_MODE (float_type_node)))))
- {
- tree fn = mathfn_built_in (type, fcode);
-
- if (fn)
- {
- tree arg0 = strip_float_extensions (TREE_VALUE (TREE_OPERAND (expr,
- 1)));
- tree arglist = build_tree_list (NULL_TREE,
- fold (convert_to_real (type, arg0)));
-
- return build_function_call_expr (fn, arglist);
- }
- }
+ /* This code formerly changed (float)floor(double d) to
+ floorf((float)d). This is incorrect, because (float)d uses
+ round-to-nearest and can round up to the next integer. */
/* Propagate the cast into the operation. */
if (itype != type && FLOAT_TYPE_P (type))