Subject: toolchain/22888: "varargs.h" (variable argument list) broken with GCC 3.3.1
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthias Scheler <tron@colwyn.zhadum.de>
List: netbsd-bugs
Date: 09/22/2003 13:54:11
>Number: 22888
>Category: toolchain
>Synopsis: "varargs.h" (variable argument list) broken with GCC 3.3.1
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 22 11:55:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.6ZC built from 2003-09-21 sources
>Organization:
Matthias Scheler http://scheler.de/~matthias/
>Environment:
System: NetBSD lyssa.zhadum.de 1.6ZC NetBSD 1.6ZC (LYSSA) #0: Sun Sep 21 15:43:26 CEST 2003 tron@lyssa.zhadum.de:/src/sys/compile/LYSSA i386
Architecture: i386
Machine: i386
>Description:
Programs using the (admittedly obsolete) variable argument list interface
via "varargs.h" cannot be compiled with GCC 3.3.1. This causes a major
portability problem which e.g. breaks the "mg2a" package.
>How-To-Repeat:
Try to compile the following (stupid and crappy) program:
#include <stdio.h>
#include <varargs.h>
static void
stupid_func(va_alist)
va_dcl
{
va_list ap;
char *str;
va_start(ap);
while ((str = va_arg(ap, char *)) != NULL)
(void) puts(str);
}
int
main(int argc, char **argv)
{
stupid_func("Hello", "World", NULL);
return 0;
}
NetBSD 1.6.1_STABLE:
tron@colwyn:~>gcc --version
2.95.3
tron@colwyn:~>gcc foobar.c -Wall -s -o foobar
tron@colwyn:~>./foobar
Hello
World
NetBSD-current:
tron@lyssa:~>gcc --version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
tron@lyssa:~>gcc foobar.c -Wall -s -o foobar
foobar.c:7: error: parse error before "__builtin_va_alist_t"
foobar.c:7: warning: type defaults to `int' in declaration of `__builtin_va_alist'
foobar.c:7: warning: data definition has no type or storage class
foobar.c:12: error: parse error before '(' token
foobar.c: In function `main':
foobar.c:20: warning: implicit declaration of function `stupid_func'
>Fix:
None provided.
>Release-Note:
>Audit-Trail:
>Unformatted: