Subject: bin/14314: gcc 2.95.3 doesn't check printf() format strings correctly
To: None <gnats-bugs@gnats.netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: netbsd-bugs
Date: 10/20/2001 14:49:53
>Number:         14314
>Category:       bin
>Synopsis:       gcc 2.95.3 doesn't check printf() format strings correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 20 14:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Chuck Silvers
>Release:        -current Sat Oct 20 14:41:29 PDT 2001
>Organization:
me
>Environment:
System: NetBSD spathi.chuq.com 1.5Y NetBSD 1.5Y (SPATHI) #2: Sun Sep 30 00:40:19 PDT 2001 chs@spathi.chuq.com:/home/chs/netbsd/src/ubc.spathi/sys/arch/i386/compile/SPATHI i386


>Description:
	gcc 2.95.3 doesn't complain when there are extra arguments to
	printf() that don't match anything in the format string.
	egcs 1.1.2 did complain about this, so code which compiles
	cleanly with the new compiler will fail with the old compiler.
	I'd say the old behaviour was more useful.

>How-To-Repeat:

compile the following program with both egcs 1.1.2 and gcc 2.95.3:

#include <stdio.h>
#include <unistd.h>

int
main()
{
	printf("hi!\n", 1);
	exit(0);
}


309 spathi:~> cc -v
Using builtin specs.
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
310 spathi:~> cc -Wmissing-prototypes -Wall -c foo.c
foo.c: In function `main':
foo.c:7: warning: too many arguments for format
311 spathi:~> 


50 spathi2:~ # /build/tooldir/bin/i386--netbsdelf-gcc -v
Reading specs from /build/tooldir/lib/gcc-lib/i386--netbsdelf/2.95.3/specs
gcc version 2.95.3 20010315 (release)
51 spathi2:~ # /build/tooldir/bin/i386--netbsdelf-gcc -Wmissing-prototypes -Wall -I/build/destdir/usr/include -c foo.c
52 spathi2:~ # 



>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: