From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sanpietro.red-bean.com ([206.69.89.65]) by hawkwind.utcs.utoronto.ca with SMTP id <45147>; Fri, 29 Dec 2000 22:53:53 -0500 Received: (from decklin@localhost) by sanpietro.red-bean.com (8.9.3/8.9.3/Debian 8.9.3-21) id VAA13486 for rc@hawkwind.utcs.toronto.edu; Fri, 29 Dec 2000 21:47:05 -0600 Date: Fri, 29 Dec 2000 22:47:05 -0500 From: Decklin Foster To: rc@hawkwind.utcs.toronto.edu Subject: va_arg and short Message-ID: <20001229214705.A13372@sanpietro.red-bean.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i X-PGP-Key: 0xF1968D1B at keyring.debian.org X-LR8R: Money can't buy you respect so go ahead and do your worst. Organization: Fulminants Association rc 1.6b2 fails to compile on linux/ppc/gcc2.95.2/glibc2.2. The problem is in print.c line 107: n = va_arg(format->args, short); This code is incorrect, because a short argument to a variadic function will go through argument promotion and become an int. I am told that GCC 3 will refuse to compile this on any architecture, not just ppc. The patch below removes the short case and adds an explanatory note. --- print.c.orig Fri Dec 29 22:34:45 2000 +++ print.c Fri Dec 29 22:39:33 2000 @@ -103,9 +103,7 @@ if (flags & FMT_long) n = va_arg(format->args, long); - else if (flags & FMT_short) - n = va_arg(format->args, short); - else + else /* short and int are both promoted to int */ n = va_arg(format->args, int); pre = 0; -- things change. decklin@red-bean.com