From: Florian Weimer <fweimer@redhat.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] libelf: Use offsetof to get field of unaligned
Date: Wed, 15 Dec 2021 23:40:08 +0100 [thread overview]
Message-ID: <87wnk5o5kn.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20211215220544.625735-1-mark@klomp.org> (Mark Wielaard's message of "Wed, 15 Dec 2021 23:05:44 +0100")
* Mark Wielaard:
> This seems a wrong warning since we aren't accessing the field member
> of the struct, but are taking the address of it. But we can do the
> same by adding the field offsetof to the base address. Which doesn't
> trigger a runtime error.
I think the warning is correct. I believe it is motivated by the GCC
optimizers using this to infer alignment of the original pointer. It
won't make a difference for this expression, but it can cause crashes
elsewhere with strict-alignment targets.
Thanks,
Florian
next prev parent reply other threads:[~2021-12-15 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 22:05 Mark Wielaard
2021-12-15 22:40 ` Florian Weimer [this message]
2021-12-16 17:12 ` Mark Wielaard
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=87wnk5o5kn.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=elfutils-devel@sourceware.org \
--cc=mark@klomp.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).