This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C frontend] Wtraditional / Wconversion and decimal float


On Mon, Aug 14, 2006 at 06:30:26PM +0100, Manuel López-Ibáñez wrote:
> Dear all,
> 
> Wtraditional warns for "Conversions by prototypes between
> fixed/floating point values               and vice versa.  The absence
> of these prototypes when compiling with traditional C would cause
> serious problems. "

> In the case of decimal float values, apart from conversions between
> integers and decimal float and viceversa, Wtraditional also warns for
> conversions between decimal and binary floats and for conversions from
> a decimal float type to a smaller decimal float type.
> 
> My questions are:
> 
> 1) Which are the rules when compiling with traditional  C, no
> prototype is given and decimal floats are involved?

ISO C in section 6.5.2.2 paragraph 6 specifies default argument
promotion for floats that are passed to functions without prototypes.
There is no default argument promotion for decimal floating types, as
specified in 6.5 of the current draft at
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1176.pdf.  Sorry, I
gave you incomplete information when you asked me about this before.
 
> 2) If the above question has a sensible answer, shouldn't we warn also
> when a smaller decimal float is converted to bigger decimal float ?

A decimal float argument is not converted, so this isn't an issue for
function calls.
 
> 3) The above question may not have a sensible answer. It may be either
> because decimal float "is a GCC extensions and thus not relevant to
> traditional C compatibility", as it says in the gcc manual page about
> Wtraditional and nested functions. Or because the behaviour is
> undefined or not documented. Whatever the reason,  why we have code
> (and a testcase!) to deal with this? Could I just remove them ? I am
> preparing a patch to add support for decimal float in Wcoercion and
> currently it removes that code and the testcase.

As for testcase you showed that passes a float to a function with a
prototype, it makes sense to me that it gets a warning for
-Wtraditional.

Janis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]