From 938d35bd4a257e6bdb74358367d21010d3fd95e2 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 28 Oct 2008 12:10:18 +0000 Subject: convert.c (strip_float_extensions): Do not remove or introduce conversions between binary and decimal... * convert.c (strip_float_extensions): Do not remove or introduce conversions between binary and decimal floating-point types. testsuite: * gcc.dg/dfp/convert-bfp-12.c: New test. From-SVN: r141407 --- gcc/convert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/convert.c') diff --git a/gcc/convert.c b/gcc/convert.c index 0fef3a2..2461772 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -81,7 +81,7 @@ strip_float_extensions (tree exp) it properly and handle it like (type)(narrowest_type)constant. This way we can optimize for instance a=a*2.0 where "a" is float but 2.0 is double constant. */ - if (TREE_CODE (exp) == REAL_CST) + if (TREE_CODE (exp) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (TREE_TYPE (exp))) { REAL_VALUE_TYPE orig; tree type = NULL; @@ -108,6 +108,9 @@ strip_float_extensions (tree exp) if (!FLOAT_TYPE_P (subt)) return exp; + if (DECIMAL_FLOAT_TYPE_P (expt) != DECIMAL_FLOAT_TYPE_P (subt)) + return exp; + if (TYPE_PRECISION (subt) > TYPE_PRECISION (expt)) return exp; -- cgit v1.1