From owner-freebsd-hackers@freebsd.org Sat May 13 17:12:13 2017 Return-Path: Delivered-To: freebsd-hackers@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 4FD07D6B2A4; Sat, 13 May 2017 17:12:13 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B29E154; Sat, 13 May 2017 17:12:13 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v4DHC8hu089182 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 13 May 2017 10:12:08 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v4DHC8qr089181; Sat, 13 May 2017 10:12:08 -0700 (PDT) (envelope-from sgk) Date: Sat, 13 May 2017 10:12:08 -0700 From: Steve Kargl To: Dimitry Andric Cc: freebsd-hackers@freebsd.org, numerics@freebsd.org, Bruce Evans Subject: Re: catrig[fl].c and inexact Message-ID: <20170513171208.GA89162@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20170512215654.GA82545@troutmask.apl.washington.edu> <20170513103208.M845@besplex.bde.org> <20170513060803.GA84399@troutmask.apl.washington.edu> <20170513162153.GB88653@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 May 2017 17:12:13 -0000 On Sat, May 13, 2017 at 06:55:27PM +0200, Dimitry Andric wrote: > On 13 May 2017, at 18:21, Steve Kargl wrote: > > > > On Sat, May 13, 2017 at 03:08:26PM +0200, Dimitry Andric wrote: > ... > > > >> Using the full catrig.c and -O3, I tried gcc 4.2.1, 4.7.4, 4.8.5, 4.9.4, > >> 5.4.0, 6.3.0 and 7.0.1, in addition to clang 3.4.1, 3.8.0, 3.9.1, 4.0.0 > >> and 5.0.0. > > > > Thanks for checking. I reduced catrig.c to a small self-contained > > program and indeed I was getting the desired addition of 1 + tiny > > to raise FE_INEXACT. I suppose that I'll need to add an appropriate > > -Wno-foo to my CFLAGS line to suppress the spurious warning, which > > might be tricky because -Wunused is one option I'ld like to have. > > The following also gets rid of the warnings: > > Index: lib/msun/src/catrig.c > =================================================================== > --- lib/msun/src/catrig.c (revision 318032) > +++ lib/msun/src/catrig.c (working copy) > @@ -37,7 +37,7 @@ > #define isinf(x) (fabs(x) == INFINITY) > #undef isnan > #define isnan(x) ((x) != (x)) > -#define raise_inexact() do { volatile float junk = 1 + tiny; } while(0) > +#define raise_inexact() do { volatile float junk __unused = 1 + tiny; } while(0) > #undef signbit > #define signbit(x) (__builtin_signbit(x)) > > Index: lib/msun/src/catrigf.c > =================================================================== > --- lib/msun/src/catrigf.c (revision 318032) > +++ lib/msun/src/catrigf.c (working copy) > @@ -51,7 +51,7 @@ > #define isinf(x) (fabsf(x) == INFINITY) > #undef isnan > #define isnan(x) ((x) != (x)) > -#define raise_inexact() do { volatile float junk = 1 + tiny; } while(0) > +#define raise_inexact() do { volatile float junk __unused = 1 + tiny; } while(0) > #undef signbit > #define signbit(x) (__builtin_signbitf(x)) > > Index: lib/msun/src/catrigl.c > =================================================================== > --- lib/msun/src/catrigl.c (revision 318032) > +++ lib/msun/src/catrigl.c (working copy) > @@ -53,7 +53,7 @@ > #define isinf(x) (fabsl(x) == INFINITY) > #undef isnan > #define isnan(x) ((x) != (x)) > -#define raise_inexact() do { volatile float junk = 1 + tiny; } while(0) > +#define raise_inexact() do { volatile float junk __unused = 1 + tiny; } while(0) > #undef signbit > #define signbit(x) (__builtin_signbitl(x)) > > If you are OK with that, I will commit it later today. > I'm OK with this change, but I typically defer to Bruce as he knows much more about C and floating point. -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow