Bug 37940

Summary: no error detected for semicolon in C function declaration
Product: gcc Reporter: Janis Johnson <janis>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: debian-gcc, gcc-bugs, janis, nightstrike
Priority: P3 Keywords: accepts-invalid
Version: 4.0.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Janis Johnson 2008-10-28 18:34:58 UTC
The following code has an extra semi-colon at the end of the function prototype declaring bad_func1:

  void bad_func1 (unsigned long long arg1, const char *arg2 ; );

  void bad_func2 ()
  {
    const char *foo = "foo";
    bad_func1 (0, foo);
  }

GCC 3.4 reports an error:

elm3b187% /home/janis/tools/gcc-3.4-anonsvn/bin/gcc -c bug.c
bug.c:1: error: parameter "arg1" has just a forward declaration
bug.c:1: error: parameter "arg2" has just a forward declaration

GCC 4.0 and later (including current mainline) accept the code with no error or warning, even with -Wall, and generate code as if the prototype did not exist rather than generating code as if the semicolon did not exist.
Comment 1 Joseph S. Myers 2008-10-28 20:25:38 UTC

*** This bug has been marked as a duplicate of 23144 ***