diff options
author | Janis Johnson <janis187@us.ibm.com> | 2006-06-23 21:17:53 +0000 |
---|---|---|
committer | Janis Johnson <janis187@us.ibm.com> | 2006-06-23 21:17:53 +0000 |
commit | 6e6dde90243f273d37f6f6d4f85ad3de13358fd3 (patch) | |
tree | 37c4db6e4704c909e6788fed55acb58ba4c4c1a2 /gcc/convert.c | |
parent | 29a4776831ddc72eedd16e78de81eda7a2162b85 (diff) |
* tree.h (DECIMAL_FLOAT_TYPE_P): New.
* c-typeck.c (c_common_type): Disallow operations on decimal float
types and other float types.
* convert.c (convert_to_real): Don't ignore conversions involving
decimal float types.
testsuite:
* gcc.dg/dfp/usual-arith-conv-bad.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@114951 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index 97977040755..ab780d8ebd3 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -315,8 +315,12 @@ convert_to_real (tree type, tree expr) switch (TREE_CODE (TREE_TYPE (expr))) { case REAL_TYPE: - return build1 (flag_float_store ? CONVERT_EXPR : NOP_EXPR, - type, expr); + /* Ignore the conversion if we don't need to store intermediate + results and neither type is a decimal float. */ + return build1 ((flag_float_store + || DECIMAL_FLOAT_TYPE_P (type) + || DECIMAL_FLOAT_TYPE_P (itype)) + ? CONVERT_EXPR : NOP_EXPR, type, expr); case INTEGER_TYPE: case ENUMERAL_TYPE: |