From: Joern Rennecke Date: Mon, 26 Aug 2013 16:22:37 +0000 (+0000) Subject: c-typeck.c (c_common_type): Prefer double_type_node over other REAL_TYPE types with... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2531a1d9f4bd1be785c98decc0b372c70edef943;p=gcc.git c-typeck.c (c_common_type): Prefer double_type_node over other REAL_TYPE types with the same precision. * c-typeck.c (c_common_type): Prefer double_type_node over other REAL_TYPE types with the same precision. (convert_arguments): Likewise. From-SVN: r202004 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 574e7c073ca..4d32d6dce3d 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2013-08-26 Joern Rennecke + + * c-typeck.c (c_common_type): Prefer double_type_node over + other REAL_TYPE types with the same precision. + (convert_arguments): Likewise. + 2013-08-23 Gabriel Dos Reis * c-objc-common.c (c_tree_printer): Document the nature of the cast. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 30871db3623..5daae23d141 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -919,6 +919,13 @@ c_common_type (tree t1, tree t2) || TYPE_MAIN_VARIANT (t2) == long_double_type_node) return long_double_type_node; + /* Likewise, prefer double to float even if same size. + We got a couple of embedded targets with 32 bit doubles, and the + pdp11 might have 64 bit floats. */ + if (TYPE_MAIN_VARIANT (t1) == double_type_node + || TYPE_MAIN_VARIANT (t2) == double_type_node) + return double_type_node; + /* Otherwise prefer the unsigned one. */ if (TYPE_UNSIGNED (t1)) @@ -3156,7 +3163,9 @@ convert_arguments (tree typelist, vec *values, } else if (TREE_CODE (valtype) == REAL_TYPE && (TYPE_PRECISION (valtype) - < TYPE_PRECISION (double_type_node)) + <= TYPE_PRECISION (double_type_node)) + && valtype != double_type_node + && valtype != long_double_type_node && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype))) { if (type_generic)