From owner-freebsd-current Tue Jan 20 11:33:29 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA27756 for current-outgoing; Tue, 20 Jan 1998 11:33:29 -0800 (PST) (envelope-from owner-freebsd-current) Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA27749 for ; Tue, 20 Jan 1998 11:33:25 -0800 (PST) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp03.primenet.com (8.8.8/8.8.8) id MAA29181 for ; Tue, 20 Jan 1998 12:33:24 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp03.primenet.com, id smtpd029161; Tue Jan 20 12:33:18 1998 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id MAA27126 for current@freebsd.org; Tue, 20 Jan 1998 12:33:18 -0700 (MST) From: Terry Lambert Message-Id: <199801201933.MAA27126@usr04.primenet.com> Subject: Nasty GCC bug? To: current@freebsd.org Date: Tue, 20 Jan 1998 19:33:18 +0000 (GMT) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I have discovered what I think is a nasty bug, having to do with passing signed smaller-than-int values to varradic functions. #include /* * demonstrate bug with signed smaller-than-int arguments to * varradic functions... */ main() { short ss = 0xebeb; unsigned short us = 0xebeb; char sc = 0xeb; unsigned char uc = 0xeb; printf( "Expecting 0x%04x, but getting 0x%04x\n", us, ss); printf( "Expecting 0x%02x, but getting 0x%02x\n", uc, sc); } What is happening is that the value is being sign-extended to int when it is pushed on the stack. I don't know how you would make "%d" and "%x" work at the same time, without a type descriptor on the stack before the argument. Maybe there needs to be a character type specifier for "%x"? Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.