public inbox for binutils-cvs@sourceware.org help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org> To: bfd-cvs@sourceware.org Subject: [binutils-gdb] gas: arm -mwarn-syms duplicates Date: Sat, 9 Jul 2022 12:34:59 +0000 (GMT) [thread overview] Message-ID: <20220709123459.D5A8F3836430@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d3be5dab558ab91789800a03fc2c1dc3c529eaf5 commit d3be5dab558ab91789800a03fc2c1dc3c529eaf5 Author: Alan Modra <amodra@gmail.com> Date: Thu Jul 7 21:41:17 2022 +0930 gas: arm -mwarn-syms duplicates arm gas is only supposed to warn once per symbol for -mwarn-syms, but doesn't because the str_hash_find added with commit 629310abec88 always returns NULL. That's so because the str_hash_insert inserts a NULL value for the key,value pair. Let str_hash_insert do the job instead. * config/tc-arm.c (arm_tc_equal_in_insn): Correct already_warned logic. * testsuite/gas/arm/pr18347.s: Modify to generate duplicate warning without this patch. Diff: --- gas/config/tc-arm.c | 7 ++----- gas/testsuite/gas/arm/pr18347.s | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 2e6d175482e..68fd6896607 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -28120,11 +28120,8 @@ arm_tc_equal_in_insn (int c ATTRIBUTE_UNUSED, char * name) already_warned = str_htab_create (); /* Only warn about the symbol once. To keep the code simple we let str_hash_insert do the lookup for us. */ - if (str_hash_find (already_warned, nbuf) == NULL) - { - as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name); - str_hash_insert (already_warned, nbuf, NULL, 0); - } + if (str_hash_insert (already_warned, nbuf, NULL, 0) == NULL) + as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name); } else free (nbuf); diff --git a/gas/testsuite/gas/arm/pr18347.s b/gas/testsuite/gas/arm/pr18347.s index 591d69baa83..64a16cb7678 100644 --- a/gas/testsuite/gas/arm/pr18347.s +++ b/gas/testsuite/gas/arm/pr18347.s @@ -1,5 +1,6 @@ MOV r1, r0 LDR =garbage // no destination register + LDR =garbage // and it should only warn once MOV r2, r3 // The warning should only be triggered by a "foo = bar"
reply other threads:[~2022-07-09 12:34 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=20220709123459.D5A8F3836430@sourceware.org \ --to=amodra@sourceware.org \ --cc=bfd-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: linkBe 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).