https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91092

--- Comment #15 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Florian Weimer from comment #14)
> (In reply to Vincent Lefèvre from comment #13)
> > By "implicit function declarations", does this include K&R style
> > declarations?
> 
> No, there is nothing implicit about them.

OK, but the issue is similar: in both cases, the parameters/arguments are not
checked, yielding undefined behavior, so that they fall in the same class.

> > I've found out a few days ago that GMP still uses K&R style declarations,
> > and that's in a configure script. The issue is that there is a potential
> > type mismatch between the caller (long) and the callee (unsigned int), and
> > GCC fails to generate "correct" code in such a case.
> 
> GNU CC has supported an extension for many, many years where a K&R function
> *definition* with a prior function prototype in scope behaves exactly as a
> prototype-style function definition.  (On some targets, the two have
> substantially different ABIs, beyond how parameters are handled.)

Actually I meant K&R function definition (with no previous prototype).

> Since the GMP headers use prototypes (they have to, otherwise they would not
> be compatible with C++ compilers), GMP necessarily relies on this extension
> today.

That's in its configure script, unrelated to gmp.h.

I can see old PR26732 and PR48091 about K&R function definition, but both are
about warnings only.

Reply via email to