This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/56910] New: Syntax error seemingly sneaks through gcc


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

             Bug #: 56910
           Summary: Syntax error seemingly sneaks through gcc
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daven@model.com


I'm not sure if the following code is triggering some obscure extension
to gcc or not, but it sure seems like it should generate a syntax
error (it does in all other compilers I've tried).

--- cut here (z.c) ---
typedef int int32_t;
typedef unsigned int uint32_t;

#include <stdio.h>

extern void vl_create_cell_reg(
    int32_t reg_idx,
    int32_t state_idx,
    uint32_t CR_flags,
    uint32_t init_val,
    char *name;  /* <--- this parameter is missing in the body and contains a
spurious ';' */
);

void vl_create_cell_reg( int32_t reg_idx, int32_t state_idx, uint32_t CR_flags,
uint32_t init_val )
{
}
--- cut here (end of z.c) ---

If I cut/paste this source to a file called "z.c", it compiles fine, i.e.:

$ gcc -c -Wall -Werror z.c
<< no errors/warnings reported >>

Note, if I remove the spurious ';', I get the expected error:

$ gcc -c -Wall -Werror z.c
z.c:15:6: error: conflicting types for âvl_create_cell_regâ
z.c:7:13: note: previous declaration of âvl_create_cell_regâ was here

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]