This is the mail archive of the 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]

[C frontend] Wtraditional / Wconversion and decimal float

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 addition, the following program:

void ffloat(float x);

void h(void)
   float y;

compiled with gcc -Wtraditional  gives the following warning : passing
argument 1 of 'ffloat' as 'float' rather than 'double' due to

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?

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 ?
(Keep in mind that this is not about losing precision or data, it is
about conversions that are different in the absence of prototypes and
compiling with traditional C).

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.

If you are still with me, thanks for your patience.



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