This fixes the following avr failures:

FAIL: gcc.dg/Wdouble-promotion.c  (test for warnings, line 45)
FAIL: gcc.dg/Wdouble-promotion.c  (test for warnings, line 52)
FAIL: gcc.dg/Wdouble-promotion.c  (test for warnings, line 53)
FAIL: gcc.dg/Wdouble-promotion.c  (test for warnings, line 56)
FAIL: gcc.dg/pr44214-2.c scan-tree-dump-times original " \\* " 1

bootstrapped/regtested on i686-pc-linux-gnu

OK to apply?
2013-05-14  Joern Rennecke  <joern.renne...@embecosm.com>

        * c-typeck.c (c_common_type): Prefer double_type_node over
        other REAL_TYPE types with the same precision.
        (convert_arguments): Likewise.

Index: c/c-typeck.c
===================================================================
--- c/c-typeck.c        (revision 201992)
+++ c/c-typeck.c        (working copy)
@@ -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<tr
        }
       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)

Reply via email to