From owner-freebsd-hackers Tue Nov 7 5:30: 9 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from starbug.ugh.net.au (starbug.ugh.net.au [203.31.238.37]) by hub.freebsd.org (Postfix) with ESMTP id 1648137B4D7 for ; Tue, 7 Nov 2000 05:30:07 -0800 (PST) Received: by starbug.ugh.net.au (Postfix, from userid 1000) id 878B2A82B; Wed, 8 Nov 2000 00:30:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by starbug.ugh.net.au (Postfix) with ESMTP id 813AC5465; Tue, 7 Nov 2000 23:30:05 +1000 (EST) Date: Tue, 7 Nov 2000 23:30:05 +1000 (EST) From: andrew@ugh.net.au To: Giorgos Keramidas Cc: hackers@freebsd.org Subject: Re: umask(2) and -Wconversion In-Reply-To: <20001107120511.A98074@gray.westgate.gr> Message-ID: X-WonK: *wibble* MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 7 Nov 2000, Giorgos Keramidas wrote: > discovered the following funny thing about -Wconversion and umask(2), I spent quite a while trying to silence that warning in one of my programs the otherday but I decided it was probably harmless and left it. > and vice versa, and conversions changing the width or signedness > of a fixed point argument except when the same as the default > promotion. I think this is what we are hitting. From memory mode_t is a u_int16_t. When you pass 0 (a 32 bit number) it gets cast to a 16 bit number (change of width) and so produces the warning. I think the reason that the cast doesn't help (or passing a u_int16_t) is that when the 16 bit number gets passed it has to be placed on the 32 bit stack which promotes it so you will always end up with a demotion when the number is taken from the stack and given to umaks as a 16 bit int. OTH I could be wrong :-) I haven't looked at the gcc source. Andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message