public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: x86: generate template sets data at build time
Date: Wed, 14 Dec 2022 08:40:37 +0100	[thread overview]
Message-ID: <f38a3591-3f6e-eba8-bd47-e50fc3679309@suse.com> (raw)
In-Reply-To: <Y5lbugPCO0ig2zB+@squeak.grove.modra.org>

On 14.12.2022 06:14, Alan Modra wrote:
>> +    /* Type checks to compensate for the conversion through void * which
>> +       occurs during hash table insertion / lookup.  */
>> +    (void)(sets == &current_templates->start);
>> +    (void)(end == &current_templates->end);
> 
> This results in asan complaining about "member access within null
> pointer of type 'const templates'".

Interesting. How can it know that current_templates is still NULL?
(I guess one can't expect it to realize that with the cast to void
this doesn't really stand a chance of exhibiting UB; technically
the compiler _may_ generate code for this nevertheless, and that
code _may_ do anything due to it being UB.) It's also not clear to
me what to do to work around the issue: Assign to current_templates
instead, followed by assigning back NULL after the checks? (This
would feel like clutter to me.) Are there other "standard" ways of
working around such border line asan complaints?

Jan

  reply	other threads:[~2022-12-14  7:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  5:14 Alan Modra
2022-12-14  7:40 ` Jan Beulich [this message]
2022-12-14  8:19   ` Alan Modra
2022-12-14  8:25     ` Jan Beulich
2022-12-14  8:27     ` Alan Modra
2022-12-14  8:57   ` Andreas Schwab

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=f38a3591-3f6e-eba8-bd47-e50fc3679309@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.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).