From owner-freebsd-current Tue Jan 20 18:11:29 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA00245 for current-outgoing; Tue, 20 Jan 1998 18:11:29 -0800 (PST) (envelope-from owner-freebsd-current) Received: from wcc.wcc.net (wcc.wcc.net [208.6.232.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA00239 for ; Tue, 20 Jan 1998 18:11:15 -0800 (PST) (envelope-from piquan@wcc.wcc.net) Received: from detlev.UUCP (newip60.wcc.net [206.104.247.60]) by wcc.wcc.net (8.8.7/8.8.7) with ESMTP id UAA23208; Tue, 20 Jan 1998 20:07:34 -0600 (CST) Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.7) id UAA01144; Tue, 20 Jan 1998 20:09:35 -0600 (CST) (envelope-from joelh) Date: Tue, 20 Jan 1998 20:09:35 -0600 (CST) Message-Id: <199801210209.UAA01144@detlev.UUCP> To: fenner@parc.xerox.com CC: sef@kithrup.com, current@FreeBSD.ORG In-reply-to: <98Jan20.171409pst.177476@crevenia.parc.xerox.com> (message from Bill Fenner on Tue, 20 Jan 1998 17:14:03 PST) Subject: Re: Nasty GCC bug? From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <98Jan20.171409pst.177476@crevenia.parc.xerox.com> Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >>> ... on systems which do not use an integer stack based calling >>> convention, the value can be treated as its type by the varradic >>> function, instead of being treated as an int. It is the promotion >>> caused by the calling convention that is the source of the >>> breakage. >> It *has* always been the case; not doing it this way is a bug. > Not quite. If you don't do it this way, the behavior is undefined -- > section 7.8.2.1: > ...or if type is not compatible with the type of the actual > next argument (as promoted according to the default argument > promotions), the behavior is undefined. > So it's not *wrong* to allow chars to be passed into varargs functions > as chars, but the ANSI C specification doesn't require it. Terry wants > to define some of this undefined behavior. I read this to mean that the promotions are required, it's just that if you mismatch types (eg, printf("%s",15);) then the results are undefined. Best, joelh -- Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan Fourth law of programming: Anything that can go wrong wi sendmail: segmentation violation - core dumped