https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88716
Bug ID: 88716
Summary: Improved diagnostics: No detection of conflicting
function definitions in some cases.
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: anders.granlund.0 at gmail dot com
Target Milestone: ---
Consider the following two test cases (prog1.c):
void f(x)
int x;
{
}
void f(int, int);
void f();
int main() {}
and (prog2.c):
void f(x)
int x;
{
}
void f();
void f(int, int);
int main() {}
Both have compile time undefined behaviour because of conflicting declarations
of the function f.
The only difference between them is the reordering of the two last
declarations.
When the first test case is compiled with
gcc prog1.c -Wall -Wextra -std=c11 -pedantic-errors
The undefined behaviour is detected and an error message is outputed.
When the second test case is compiled with
gcc prog2.c -Wall -Wextra -std=c11 -pedantic-errors
The undefined behaviour is not detected.
It would be good if gcc could detect the undefined behaviour even in the second
case.