Commit 0fdd4508 by Joern Rennecke Committed by Joern Rennecke

re PR c/35649 (Incorrect printf warning: expect double has float)

2013-08-26  Joern Rennecke  <joern.rennecke@embecosm.com>
            Joseph Myers  <joseph@codesourcery.com>

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

Amend patch as suggested:
From:  	"Joseph S. Myers" <joseph@codesourcery.com>
In convert_arguments I think you should be comparing TYPE_MAIN_VARIANT
(valtype) against double_type_node and long_double_type_node, rather than
just valtype.

This is PR c/35649 (so include that number in your ChangeLog entry and
close that bug as fixed).

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>

From-SVN: r202006
parent 907555ce
2013-08-26 Joern Rennecke <joern.rennecke@embecosm.com> 2013-08-26 Joern Rennecke <joern.rennecke@embecosm.com>
Joseph Myers <joseph@codesourcery.com>
c/35649
* c-typeck.c (c_common_type): Prefer double_type_node over * c-typeck.c (c_common_type): Prefer double_type_node over
other REAL_TYPE types with the same precision. other REAL_TYPE types with the same precision.
(convert_arguments): Likewise. (convert_arguments): Likewise.
......
...@@ -3164,8 +3164,8 @@ convert_arguments (tree typelist, vec<tree, va_gc> *values, ...@@ -3164,8 +3164,8 @@ convert_arguments (tree typelist, vec<tree, va_gc> *values,
else if (TREE_CODE (valtype) == REAL_TYPE else if (TREE_CODE (valtype) == REAL_TYPE
&& (TYPE_PRECISION (valtype) && (TYPE_PRECISION (valtype)
<= TYPE_PRECISION (double_type_node)) <= TYPE_PRECISION (double_type_node))
&& valtype != double_type_node && TYPE_MAIN_VARIANT (valtype) != double_type_node
&& valtype != long_double_type_node && TYPE_MAIN_VARIANT (valtype) != long_double_type_node
&& !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype))) && !DECIMAL_FLOAT_MODE_P (TYPE_MODE (valtype)))
{ {
if (type_generic) if (type_generic)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment