This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Q: middle-end problem when variadic builtins promote float to double
On Sat, 7 Jul 2007, Kaveh R. GHAZI wrote:
> Ok, here's a patch which adds the attribute named as you suggest and
> applies it to the relevant builtins. I'm stuck now on how and where we
> would intervene to honor it. I think we need to do it in c-decl.c:
> grokdeclarator(), where it says "promoted_type = c_type_promotes_to(type)"
> around line 4757. However I'm not sure if we have a handle on the
No, that's something else entirely (a "float" old-style parameter
declaration corresponds to a "double" argument in a prototype). It's
convert_arguments that handles converting to prototype types and default
argument promotions for arguments not covered by a prototype (including
those in the ... of a variadic function).
else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE
&& (TYPE_PRECISION (TREE_TYPE (val))
< TYPE_PRECISION (double_type_node))
&& !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (val))))
/* Convert `float' to `double'. */
argarray[parmnum] = convert (double_type_node, val);
--
Joseph S. Myers
joseph@codesourcery.com