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.
Confirmed.
Author: mpolacek Date: Wed Oct 21 17:30:20 2015 New Revision: 229131 URL: https://gcc.gnu.org/viewcvs?rev=229131&root=gcc&view=rev Log: PR c/68024 * c-decl.c (start_function): Warn about vararg functions without a prototype. * gcc.dg/pr68024.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr68024.c Modified: trunk/gcc/c/ChangeLog trunk/gcc/c/c-decl.c trunk/gcc/testsuite/ChangeLog
Fixed.