http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48091
Eero Tamminen <eerott at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|No warning when given |No warning when given |function arguments mismatch |function arguments mismatch |earlier, old style K&R |earlier function definition |function definition |which GCC assumes to be K&R --- Comment #3 from Eero Tamminen <eerott at gmail dot com> 2011-03-30 17:59:26 UTC --- Another example about how dangerous this default GCC behavior is. Consider code A: ------------------ static int a, b; void set_a(int i) { a = i; } void set_b(int i) { b = i; } int add() { return a+b; } ------------------ And its usage from elsewhere: ------------------ #include <stdio.h> int main(int argc, const char *argv[] __attribute__((unused))) { return add(argc, 50); } ------------------ GCC doesn't catch this because it assumes the code is obsolete K&R syntax without even bothering to give user a warning about it. Even when user is requesting warnings with options like: gcc -Wall -Wextra --std=c99 -pedantic -O2 test.c Code A) is *not* K&R. Nowadays it's either C++ code copied to a C program or code from people who don't know or remember that only in C++ "add()" means void argument whereas in ANSI-C "add(void)" should be used. I see this in (non-K&R) C sources all the time, it's very common mistake about which GCC doesn't bother to give any warning. Confirmed?