This is the mail archive of the
mailing list for the GCC project.
Re: [C frontend] Wtraditional / Wconversion and decimal float
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 14 Aug 2006 12:45:55 -0700
- Subject: Re: [C frontend] Wtraditional / Wconversion and decimal float
- References: <firstname.lastname@example.org>
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 220.127.116.11 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
> 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