* [PATCH] Fix warnings from latest GCC
@ 2016-10-10 22:16 Steve Ellcey
2016-10-10 22:25 ` Joseph Myers
0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey @ 2016-10-10 22:16 UTC (permalink / raw)
To: libc-alpha
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]
I was building the top-of-tree glibc with the top-of-tree GCC and ran into
some new GCC errors.
../sysdeps/ieee754/dbl-64/e_pow.c: In function âcheckintâ:
../sysdeps/ieee754/dbl-64/e_pow.c:469:13: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
if (n << (k - 20))
~~^~~~~~~~~~~
../sysdeps/ieee754/dbl-64/e_pow.c:471:17: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
return (n << (k - 21)) ? -1 : 1;
~~~^~~~~~~~~~~~
../sysdeps/ieee754/dbl-64/e_pow.c:477:9: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
if (m << (k + 12))
~~^~~~~~~~~~~
../sysdeps/ieee754/dbl-64/e_pow.c:479:13: error: << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
return (m << (k + 11)) ? -1 : 1;
~~~^~~~~~~~~~~~
cc1: all warnings being treated as errors
The easiest fix seems to be to add explicit '!= 0' to these lines. I did this
and verified that the generated code (on aarch64) is identical.
OK to checkin?
Steve Ellcey
sellcey@caviumnetworks.com (previously sellcey@imgtec.com)
* e_pow.c (checkint) Make conditions explicitly boolean.
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index 663fa39..bd758b5 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -466,15 +466,15 @@ checkint (double x)
return (n & 1) ? -1 : 1; /* odd or even */
if (k > 20)
{
- if (n << (k - 20))
+ if (n << (k - 20) != 0)
return 0; /* if not integer */
- return (n << (k - 21)) ? -1 : 1;
+ return (n << (k - 21) != 0) ? -1 : 1;
}
if (n)
return 0; /*if not integer */
if (k == 20)
return (m & 1) ? -1 : 1;
- if (m << (k + 12))
+ if (m << (k + 12) != 0)
return 0;
- return (m << (k + 11)) ? -1 : 1;
+ return (m << (k + 11) != 0) ? -1 : 1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix warnings from latest GCC
2016-10-10 22:16 [PATCH] Fix warnings from latest GCC Steve Ellcey
@ 2016-10-10 22:25 ` Joseph Myers
0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2016-10-10 22:25 UTC (permalink / raw)
To: Steve Ellcey; +Cc: libc-alpha
On Mon, 10 Oct 2016, Steve Ellcey wrote:
> The easiest fix seems to be to add explicit '!= 0' to these lines. I did this
> and verified that the generated code (on aarch64) is identical.
>
> OK to checkin?
OK (this accords with the glibc rule that such implicit boolean
conversions should be avoided).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-10 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 22:16 [PATCH] Fix warnings from latest GCC Steve Ellcey
2016-10-10 22:25 ` Joseph Myers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).