c/5503: GCC 3.0.3 ignores the prototype for fputs()

lukas@saintmail.net lukas@saintmail.net
Sat Jan 26 15:26:00 GMT 2002


>Number:         5503
>Category:       c
>Synopsis:       GCC ignores prototype
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 26 15:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Mai
>Release:        3.0.3
>Organization:
>Environment:
System: Linux barubary 2.2.18 #1 Fri Jan 19 22:10:35 GMT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0.3/configure --program-suffix=-3.0.3
>Description:
GCC 3.0.3 ignores the prototype for fputs(). It compiles a call with the wrong
number or type of arguments without any errors or warnings. The resulting
executable crashes (Segmentation fault).
>How-To-Repeat:
/* This program compiles without complaints using `gcc -W -Wall' */
int fputs(int, int, int);
int main(void) {
	fputs(42);
	return 0;
}
>Fix:
To work around this, you could use a wrapper function:
int wrap_fputs(const char *s, FILE *stream) {
	return fputs(s, stream);
}
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list