public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: binutils@sourceware.org
Subject: Commit: PR 21964: Fix testcase compile time warnings
Date: Tue, 01 Mar 2022 10:09:54 +0000	[thread overview]
Message-ID: <877d9egf0t.fsf@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

Hi Guys,

  I am checking in the attached patch to fix a compile time warning
  generated by GCC version 12 when building the source files for the
  pr21964 linker test cases:

    ld/testsuite/ld-elf/pr21964-1a.c: In function 'foo1':
    ld/testsuite/ld-elf/pr21964-1a.c:7:25: warning: comparison between two arrays [-Warray-compare]
    7 |   if (__start___verbose == __stop___verbose
    ld/testsuite/ld-elf/pr21964-1a.c:7:25: note: use '&__start___verbose[0] == &__stop___verbose[0]' to compare the addresses

  There are similar warnings for the other source files for this PR and
  this patch fixes them all.  The presence of the warning messages means
  that the tests are considered to be UNSUPPORTED when in fact they do
  work.

Cheers
  Nick

ld/ChangeLog
2022-03-01  Nick Clifton  <nickc@redhat.com>

	PR 21964
	* testsuite/ld-elf/pr21964-1a.c: Fix array comparisons.
	* testsuite/ld-elf/pr21964-1b.c: Likewise.
	* testsuite/ld-elf/pr21964-1c.c: Likewise.
	* testsuite/ld-elf/pr21964-2a.c: Likewise.
	* testsuite/ld-elf/pr21964-2b.c: Likewise.
	* testsuite/ld-elf/pr21964-3a.c: Likewise.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr21964-testcases.patch --]
[-- Type: text/x-patch, Size: 2740 bytes --]

diff --git a/ld/testsuite/ld-elf/pr21964-1a.c b/ld/testsuite/ld-elf/pr21964-1a.c
index 680bda4dbfe..a060162ddad 100644
--- a/ld/testsuite/ld-elf/pr21964-1a.c
+++ b/ld/testsuite/ld-elf/pr21964-1a.c
@@ -4,7 +4,7 @@ int
 foo1 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 5;
-  if (__start___verbose == __stop___verbose
+  if (& __start___verbose[0] == & __stop___verbose[0]
       || __start___verbose[0] != 5)
     return -1;
   else
diff --git a/ld/testsuite/ld-elf/pr21964-1b.c b/ld/testsuite/ld-elf/pr21964-1b.c
index 1507b228088..688bbeb6870 100644
--- a/ld/testsuite/ld-elf/pr21964-1b.c
+++ b/ld/testsuite/ld-elf/pr21964-1b.c
@@ -4,7 +4,7 @@ int
 foo2 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 10;
-  if (__start___verbose == __stop___verbose
+  if (& __start___verbose[0] == & __stop___verbose[0]
       || __start___verbose[0] != 10)
     return -1;
   else
diff --git a/ld/testsuite/ld-elf/pr21964-1c.c b/ld/testsuite/ld-elf/pr21964-1c.c
index 996a9e182f4..58322bcc227 100644
--- a/ld/testsuite/ld-elf/pr21964-1c.c
+++ b/ld/testsuite/ld-elf/pr21964-1c.c
@@ -9,7 +9,7 @@ static int my_var __attribute__((used, section("__verbose"))) = 6;
 int
 bar (void)
 {
-  if (__start___verbose == __stop___verbose)
+  if (& __start___verbose[0] == & __stop___verbose[0])
     return -1;
 
   if (__start___verbose[0] != 6)
diff --git a/ld/testsuite/ld-elf/pr21964-2a.c b/ld/testsuite/ld-elf/pr21964-2a.c
index 6331ff063b9..8b1afca2acc 100644
--- a/ld/testsuite/ld-elf/pr21964-2a.c
+++ b/ld/testsuite/ld-elf/pr21964-2a.c
@@ -4,7 +4,7 @@ int
 foo1 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 5;
-  if (__start___verbose == __stop___verbose
+  if (& __start___verbose[0] == & __stop___verbose[0]
       && __start___verbose[0] != 5)
     return -1;
   else
diff --git a/ld/testsuite/ld-elf/pr21964-2b.c b/ld/testsuite/ld-elf/pr21964-2b.c
index 1507b228088..688bbeb6870 100644
--- a/ld/testsuite/ld-elf/pr21964-2b.c
+++ b/ld/testsuite/ld-elf/pr21964-2b.c
@@ -4,7 +4,7 @@ int
 foo2 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 10;
-  if (__start___verbose == __stop___verbose
+  if (& __start___verbose[0] == & __stop___verbose[0]
       || __start___verbose[0] != 10)
     return -1;
   else
diff --git a/ld/testsuite/ld-elf/pr21964-3a.c b/ld/testsuite/ld-elf/pr21964-3a.c
index 835040ee342..89f7b883573 100644
--- a/ld/testsuite/ld-elf/pr21964-3a.c
+++ b/ld/testsuite/ld-elf/pr21964-3a.c
@@ -3,7 +3,7 @@ extern int __stop___verbose[];
 int
 foo3 (void)
 {
-  if (__start___verbose == __stop___verbose
+  if (& __start___verbose[0] == & __stop___verbose[0]
       || __start___verbose[0] != 6)
     return -1;
   else

                 reply	other threads:[~2022-03-01 10:10 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=877d9egf0t.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@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).