public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/release/2.34/master] Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare
Date: Thu, 12 Jan 2023 06:21:26 +0000 (GMT)	[thread overview]
Message-ID: <20230112062126.8598A3857C44@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=26c7c6bac9da305b634a661aa491dae2756581ec

commit 26c7c6bac9da305b634a661aa491dae2756581ec
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Oct 5 14:25:40 2021 +0000

    Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare
    
    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.
    
    (cherry picked from commit a0f0c08e4fe18e78866539b0571f8e4b57dba7a3)

Diff:
---
 stdlib/tst-setcontext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);

                 reply	other threads:[~2023-01-12  6:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230112062126.8598A3857C44@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).