* Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare
@ 2021-10-04 18:42 Joseph Myers
2021-10-05 11:35 ` Adhemerval Zanella
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2021-10-04 18:42 UTC (permalink / raw)
To: libc-alpha
Building stdlib/tst-setcontext.c fails with GCC mainline:
tst-setcontext.c: In function 'f2':
tst-setcontext.c:61:16: error: comparison between two arrays [-Werror=array-compare]
61 | if (on_stack < st2 || on_stack >= st2 + sizeof (st2))
| ^
tst-setcontext.c:61:16: note: use '&on_stack[0] < &st2[0]' to compare the addresses
The comparison in this case is deliberate, so adjust it as suggested
in that note.
Tested with build-many-glibcs.py (GCC mainline) for aarch64-linux-gnu.
diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c
index 1b511708c1..1c2925bb76 100644
--- a/stdlib/tst-setcontext.c
+++ b/stdlib/tst-setcontext.c
@@ -58,7 +58,7 @@ f2 (void)
puts ("start f2");
printf ("&on_stack=%p\n", on_stack);
- if (on_stack < st2 || on_stack >= st2 + sizeof (st2))
+ if (&on_stack[0] < &st2[0] || &on_stack[0] >= st2 + sizeof (st2))
{
printf ("%s: memory stack is not where it belongs!", __FUNCTION__);
exit (1);
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare
2021-10-04 18:42 Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare Joseph Myers
@ 2021-10-05 11:35 ` Adhemerval Zanella
0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2021-10-05 11:35 UTC (permalink / raw)
To: Joseph Myers, libc-alpha
On 04/10/2021 15:42, Joseph Myers wrote:
> Building stdlib/tst-setcontext.c fails with GCC mainline:
>
> tst-setcontext.c: In function 'f2':
> tst-setcontext.c:61:16: error: comparison between two arrays [-Werror=array-compare]
> 61 | if (on_stack < st2 || on_stack >= st2 + sizeof (st2))
> | ^
> tst-setcontext.c:61:16: note: use '&on_stack[0] < &st2[0]' to compare the addresses
>
> The comparison in this case is deliberate, so adjust it as suggested
> in that note.
>
> Tested with build-many-glibcs.py (GCC mainline) for aarch64-linux-gnu.
>
LGTM, thanks.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c
> index 1b511708c1..1c2925bb76 100644
> --- a/stdlib/tst-setcontext.c
> +++ b/stdlib/tst-setcontext.c
> @@ -58,7 +58,7 @@ f2 (void)
> puts ("start f2");
>
> printf ("&on_stack=%p\n", on_stack);
> - if (on_stack < st2 || on_stack >= st2 + sizeof (st2))
> + if (&on_stack[0] < &st2[0] || &on_stack[0] >= st2 + sizeof (st2))
> {
> printf ("%s: memory stack is not where it belongs!", __FUNCTION__);
> exit (1);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-05 11:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 18:42 Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare Joseph Myers
2021-10-05 11:35 ` Adhemerval Zanella
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).