http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53532
Bug #: 53532 Summary: function call ignored when called with argument of incompatible, undefined structure Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: mach...@post.cz The following code... struct aaa {}; extern int xxx(struct aaa e); int main() { xxx((struct bbb) {}); return 0; } ... compiles without warnings and the call to xxx is ignored: # gcc -Wall -Wextra -c foo.c # objdump -x foo.o [...] Disassembly of section .text: 0000000000000000 <main>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: b8 00 00 00 00 mov $0x0,%eax 9: 5d pop %rbp a: c3 retq [...] The code above seems invalid, and I think that gcc should reject it. The definition of struct aaa is somehow important. When dropped, GCC realizes things are wrong, and complains abundantly. # LANG=C gcc -Wall -Wextra -x c /dev/stdin extern int xxx(struct aaa e); int main() { xxx((struct bbb) {}); return 0; } /dev/stdin:1:23: warning: 'struct aaa' declared inside parameter list [enabled by default] /dev/stdin:1:23: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] /dev/stdin: In function 'main': /dev/stdin:3:15: error: type of formal parameter 1 is incomplete It also complains about struct bbb being incomplete, which it didn't mind at all while aaa was there.