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.


-- 
           Summary: no error detected for semicolon in C function
                    declaration
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37940

Reply via email to