https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024
Bug ID: 68024 Summary: Diagnose variadic functions defined without prototypes Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- As a quality-of-implementation-issue, we should diagnose code such as: void f (int, ...); void f (a) int a; {} which defines a variadic function without using "...". The types are compatible as defined by ISO C (see C11 6.7.6.3#15), so no diagnostic is required. However, this case is explicitly undefined behavior (C11 6.9.1#8: "If a function that accepts a variable number of arguments is defined without a parameter type list that ends with the ellipsis notation, the behavior is undefined."; likewise back to C90). So it is valid to reject it (this is undefined behavior as a property of a program, not of a particular execution of a program), and certainly seems a good idea at least to give a diagnostic. This showed up with such a (declaration, definition) pair in glibc only being diagnosed after converting the definition from K&R style to prototype-style.