From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 8598A3857C44; Thu, 12 Jan 2023 06:21:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8598A3857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673504486; bh=4NfgHc+8pl4dzmRUyTHObsVxFbenvUe9k8Fhn0MXcWE=; h=From:To:Subject:Date:From; b=Y4DTZ0M1oOipUnnd2ppVHFs0vl/ZwFudNJ71fgPlik1hgVdlHLJn65LYJdYqZgDjw /wWJXhgfJVqhqEcgMbWsVwZtl2Lj0+yZuYk5WPxqIhRVsOCaZU0piibLnbgf4iivvM qP7XWFCPJOly1rQ+54uDKImPmEdFuDEoO9yzeOeI= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc/release/2.34/master] Fix stdlib/tst-setcontext.c for GCC 12 -Warray-compare X-Act-Checkin: glibc X-Git-Author: Joseph Myers X-Git-Refname: refs/heads/release/2.34/master X-Git-Oldrev: 92d5c52aaac0fa8e58b92e96bf2025d6848a2845 X-Git-Newrev: 26c7c6bac9da305b634a661aa491dae2756581ec Message-Id: <20230112062126.8598A3857C44@sourceware.org> Date: Thu, 12 Jan 2023 06:21:26 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=26c7c6bac9da305b634a661aa491dae2756581ec commit 26c7c6bac9da305b634a661aa491dae2756581ec Author: Joseph Myers 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);