[Bug c/83117] [8 Regression] FAIL: gcc.target/x86_64/abi/ms-sysv/ms-sysv.c (test for excess errors)

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 25 19:25:00 GMT 2017


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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
C requires that every function must be declared and called by [an expression
of] a compatible type and specifies special rules for the ellipsis and for
functions without a prototype.

For two function types to be compatible, ... If one type has a parameter type
list and the other type is specified by a function declarator that is not part
of a function definition and that contains an empty identifier list, the
parameter list shall not have an ellipsis terminator.

In the snippet in comment #2:

  extern long do_test_aligned ();

  static long (*const do_test_v1) (long a, ...) = (void *) do_test_aligned;

  do_test_v1 (a);

do_test_aligned has an empty identifier list and do_test_v1's parameter list
ends in an ellipsis, making the two incompatible.  So either the call is
undefined or the two declarations of do_test_aligned, one without a prototype
and one with (matching do_test_v1, in some other translation unit), are
undefined.

I don't know if GCC supports any targets where this incompatibility is, in
fact, undefined.  If not, then perhaps the warning in this specific case should
only be issued with -Wpedantic.

In any event, I think the warning should have an option controlling it.

The phrasing could also be improved: both the established term and the
preferred English word is "incompatible" (not "non-compatible").


More information about the Gcc-bugs mailing list