catrig[fl].c and inexact

Dimitry Andric dimitry at andric.com
Sat May 13 16:55:38 UTC 2017


On 13 May 2017, at 18:21, Steve Kargl <sgk at troutmask.apl.washington.edu> 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.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20170513/de043b67/attachment.sig>


More information about the freebsd-hackers mailing list