From owner-freebsd-arch@FreeBSD.ORG Wed Mar 11 18:26:14 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F09F4358 for ; Wed, 11 Mar 2015 18:26:14 +0000 (UTC) Received: from mail.strugglingcoder.info (strugglingcoder.info [65.19.130.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8604859 for ; Wed, 11 Mar 2015 18:26:14 +0000 (UTC) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPSA id DD67E104DB9; Wed, 11 Mar 2015 11:26:12 -0700 (PDT) Date: Wed, 11 Mar 2015 11:26:12 -0700 From: hiren panchasara To: "Simon J. Gerraty" Subject: Re: Buggy sbspace() on 64bit builds? Message-ID: <20150311182612.GL88380@strugglingcoder.info> References: <20150206183036.S1246@besplex.bde.org> <5977.1423271024@chaos> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Ck22u5fw4m2k6hx2" Content-Disposition: inline In-Reply-To: <5977.1423271024@chaos> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Anuranjan Shukla , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2015 18:26:15 -0000 --Ck22u5fw4m2k6hx2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 02/06/15 at 05:03P, Simon J. Gerraty wrote: > Anuranjan Shukla wrote: > > this, along with return value being 'int' acceptable as a final > > determination?=20 >=20 > It is ok for the function to return long,=20 > so long as an int is used internally. > Casting the int to long - implicit on return does no harm. >=20 > #include > #include > #include >=20 > int > main(int argc, char *argv[]) > { > uint a, b; > long r1; > int r2; >=20 > a =3D 1; > b =3D 2; >=20 > r1 =3D a - b; > r2 =3D a - b; >=20 > printf("r1=3D%ld\nr2=3D%d\nr3=3D%ld\n", r1, r2, (long)r2); > exit(0); > } >=20 > r1=3D4294967295 > r2=3D-1 > r3=3D-1 >=20 > so I think just using 'int' internally should work for now, > perhaps with a comment saying the object size should match > those being subtracted etc. Hi Simon/Anu, Has this been committed yet? I believe I am running into something similar in our stable10 build. I am not certain though. In any case, this should be committed/mfc'd. Cheers, Hiren --Ck22u5fw4m2k6hx2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQF8BAEBCgBmBQJVAIjEXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l9tUH/3/4B5XRumcFM28t70LIb/27 lnNEU+Xy9ZDfTbZ2J/JNNGgwgJ9jk3rMS3G5vtfKgdSZcCsqxMsJtfiG3Z1Mu9Tn +n/baWWG5JeZzArFHuzR9Svly1sJD/EAm3K+UL1dTWjgFMpgYnstHAeTeMqlW3jb jhKh458zhztZMwQWOQGgUrEnhz9eYmObVF1rr48VFmVX3BE2oaw76SwwtBweE+Ti E1UVxvlsQrSHV+QoutHCEx/f0bh1QnuBL7Ps6m8h4prrJrA073rXG+Rp9JTmACEr Y5ionOdjPmrRWJqxnou1wCsn8WT1D7aHqszqOa17ifXZJK4mo+Syae04huu88Yw= =dj1p -----END PGP SIGNATURE----- --Ck22u5fw4m2k6hx2--