From owner-freebsd-current Tue Jan 20 14:02:24 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA10244 for current-outgoing; Tue, 20 Jan 1998 14:02:24 -0800 (PST) (envelope-from owner-freebsd-current) Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA10239 for ; Tue, 20 Jan 1998 14:02:16 -0800 (PST) (envelope-from tlambert@usr06.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id PAA10136; Tue, 20 Jan 1998 15:02:10 -0700 (MST) Received: from usr06.primenet.com(206.165.6.206) via SMTP by smtp02.primenet.com, id smtpd010121; Tue Jan 20 15:02:08 1998 Received: (from tlambert@localhost) by usr06.primenet.com (8.8.5/8.8.5) id PAA00510; Tue, 20 Jan 1998 15:02:07 -0700 (MST) From: Terry Lambert Message-Id: <199801202202.PAA00510@usr06.primenet.com> Subject: Re: Nasty GCC bug? To: sef@kithrup.com (Sean Eric Fagan) Date: Tue, 20 Jan 1998 22:02:07 +0000 (GMT) Cc: current@FreeBSD.ORG In-Reply-To: <199801202123.NAA15093@kithrup.com> from "Sean Eric Fagan" at Jan 20, 98 01:23:31 pm 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 don't normally do this, but: Terry you don't know what you're talking > about. As I've explained in my two messages today. [ ... ] > It's not my fault the program in question was buggy -- it has always been the > case that you had to mask out signed char values for printf statements, since > printf has never had a size modifier to treat a char-sized value as an > integer. Is is an artifact of the calling convention, which is implementation defined. It has *NOT* "always been the case"; 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. VMS is one such system; it makes calls by descriptor rather than by integers on a stack. The descriptor contains the type information, and it does the unsurprising, and outputs via printf that which was input via scanf in such a way as to allow the program to run against the data that was output. It is probably more corrrect to say "the program depended on implementation defined behavior". Nevertheless, I was surprised when my data got garbled. 8-|. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.