From owner-svn-src-head@freebsd.org Fri Aug 25 23:23:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 329A1DE3C59; Fri, 25 Aug 2017 23:23:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id ED6EE74FBC; Fri, 25 Aug 2017 23:23:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 12CA5102F24; Sat, 26 Aug 2017 09:23:07 +1000 (AEST) Date: Sat, 26 Aug 2017 09:23:06 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Matt Joras cc: cem@freebsd.org, Alan Somers , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r322893 - head/bin/dd In-Reply-To: <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> Message-ID: <20170826085102.S976@besplex.bde.org> References: <201708251531.v7PFVtoZ038242@repo.freebsd.org> <4b016f89-61c5-fc8a-a36a-aca8166c369e@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=LI0WeNe9 c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=FwyhkCkCfzX_Wn5THrUA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Aug 2017 23:23:14 -0000 On Fri, 25 Aug 2017, Matt Joras wrote: > On 08/25/2017 10:17, Conrad Meyer wrote: >> This change seems to break buildworld on MIPS: >> >> /home/cem/head.svn/bin/dd/args.c: In function 'f_bs': >> /home/cem/head.svn/bin/dd/args.c:188: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_cbs': >> /home/cem/head.svn/bin/dd/args.c:199: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_ibs': >> /home/cem/head.svn/bin/dd/args.c:245: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> /home/cem/head.svn/bin/dd/args.c: In function 'f_obs': >> /home/cem/head.svn/bin/dd/args.c:266: warning: format '%zd' expects >> type 'signed size_t', but argument 3 has type 'long int' >> >> (Yes, it's odd that the SSIZE_MAX constant has 'long' type.) >> > SSIZE_MAX should have type long, since ssize_t is a long on mips (and > other arches besides i386 and arm). Actually the reverse. ssize_t has the correct type int32_t (which happens to be int) on all 32-bit arches. SSIZE_MAX shouldn't have type long on 32-bit arches, but is broken by having that type on arm > Re: the build failure, that's in the GCC C format string checking, so > perhaps it's more accurate to say this breaks the (in-tree) GCC build. > %zd is the right format specifier for ssize_t. I guess GCC's format > string checking is getting confused because SSIZE_MAX is a constant that > expands to type long. Perhaps casting to ssize_t would GCC happier, but > that looks rather wrong. This is because gcc's format checking actually works. It detects that SSIZE_MAX has the incorrect type long on mips because it is defined as LONG_MAX there. arm/arm64, powerpc and x86 have ifdefs to define it correctly as INT_MAX in the 32-bit case. I finally found where POSIX requires SSIZE_MAX to have the "correct" type (POSIX doesn't define what that is. but C99 does). SSIZE_MAX is just in convered by the same rule as most C99 limits for integer types. So SSIZE_MAX is not permitted to be what it is on mips. Bruce