NetBSD Problem Report #22888

Received: (qmail 15999 invoked by uid 605); 22 Sep 2003 11:54:14 -0000
Message-Id: <200309221154.h8MBsBPN004582@lyssa.zhadum.de>
Date: Mon, 22 Sep 2003 13:54:11 +0200 (CEST)
From: Matthias Scheler <tron@colwyn.zhadum.de>
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: tron@colwyn.zhadum.de
To: gnats-bugs@gnats.netbsd.org
Subject: "varargs.h" (variable argument list) broken with GCC 3.3.1
X-Send-Pr-Version: 3.95

>Number:         22888
>Category:       toolchain
>Synopsis:       "varargs.h" (variable argument list) broken with GCC 3.3.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    tron
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 22 11:55:00 +0000 2003
>Closed-Date:    Tue Oct 14 12:48:17 +0000 2003
>Last-Modified:  Tue Oct 14 12:48:17 +0000 2003
>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:

From: Richard Earnshaw <rearnsha@arm.com>
To: tron@colwyn.zhadum.de
Cc: gnats-bugs@gnats.netbsd.org, Richard.Earnshaw@arm.com
Subject: Re: toolchain/22888: "varargs.h" (variable argument list) broken 
 with GCC 3.3.1
Date: Mon, 22 Sep 2003 13:44:21 +0100

 GCC 3.3 no-longer contains internal support for varargs.h (other support 
 for -traditional has been removed as well).  The best fix would be to 
 change varargs.h to emit a #error if it is included by a gcc 3 compiler.

 R.

Responsible-Changed-From-To: toolchain-manager->tron 
Responsible-Changed-By: tron 
Responsible-Changed-When: Tue Oct 14 12:44:42 UTC 2003 
Responsible-Changed-Why:  
I'll handle this PR. 

From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/22888 CVS commit: src
Date: Tue, 14 Oct 2003 12:46:44 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Tue Oct 14 12:46:44 UTC 2003

 Modified Files:
 	src/include: Makefile
 	src/sys/arch: Makefile
 Added Files:
 	src/include: varargs.h

 Log Message:
 Replace symbolic link "/usr/include/varargs.h" (pointing to
 "/usr/include/machine/varargs.h") by a stub include file which will
 emit an error if GCC 3.3 or newer is used and include "machine/varargs.h"
 otherwise.

 Based on a suggestion by Richard Earnshaw. This fixes PR toolchain/22888
 by myself.


 To generate a diff of this commit:
 cvs rdiff -r1.114 -r1.115 src/include/Makefile
 cvs rdiff -r0 -r1.1 src/include/varargs.h
 cvs rdiff -r1.24 -r1.25 src/sys/arch/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Tue Oct 14 12:48:02 UTC 2003 
State-Changed-Why:  
Fixed as suggested. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.