c/3116: Bug with using oldstyle prototype declarations
Andreas Jaeger
aj@suse.de
Mon Jun 11 02:06:00 GMT 2001
>Number: 3116
>Category: c
>Synopsis: Bug with using oldstyle prototype declarations
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Jun 11 02:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.1 20010610 (experimental) (also 3.0 20010609)
>Organization:
SuSE
>Environment:
System: Linux gee 2.2.19 #1 Mon Apr 30 20:46:41 GMT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /cvs/gcc/configure --prefix=/opt/gcc-3.1-devel --enable-shared --enable-threads=posix --with-gnu-as --with-gnu-ld --disable-nls --with-system-zlib --enable-languages=c,objc,c++,f77,java
>Description:
Compile the appended code, you get:
gee:~/tmp:[0]$ /opt/gcc-3.1-devel/bin/gcc -Wall -c fgetws.c
fgetws.c: In function `fgetws':
fgetws.c:18: argument `fp' doesn't match prototype
fgetws.c:11: prototype declaration
>How-To-Repeat:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct _IO_FILE {
int _flags;
};
typedef struct _IO_FILE __FILE;
typedef struct _IO_FILE _IO_FILE;
typedef long int wchar_t;
extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
__FILE *__restrict __stream);
#if 1
wchar_t *
fgetws (buf, n, fp)
wchar_t *buf;
int n;
_IO_FILE *fp;
{
return (wchar_t *)0;
}
#else
wchar_t *
fgetws (wchar_t *buf,int n, _IO_FILE * fp)
{
return (wchar_t *)0;
}
#endif
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The other case (#if 0) works, only old style prototypes are broken.
This is a regression from gcc 2.95.3.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list