public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rearnsha at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/113045] armv7l-unknown-linux-gnueabihf: valgrind error during build of libcc1
Date: Tue, 02 Jan 2024 14:40:54 +0000	[thread overview]
Message-ID: <bug-113045-4-EqWDUR9hX7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113045-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113045

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu.org

--- Comment #20 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #9)
> This is almost definitely a valgrind issue.
> We start with:
>   /* Align the source pointer.  */
>   misalign = (uintptr_t)s & 15;
>   p = (const uint8_t *)((uintptr_t)s & -16);
>   data = vld1q_u8 (p);
> 
> 
> Which all other targets do too.
> 
> Basically this is how you realign the pointer and if don't depend on the
> bytes that is not in the original pointer, then this is valid.
> 
> Does it work correctly without valgrind?

Yes, for the first fetch, we align down to a 16-byte boundary and fetch the
full 16 bytes.  We then mask off the bytes that are before the real start of
the buffer so that they cannot affect the result.  So the code is safe, but
valgrind has no real way of knowing this.

Tricks like this wouldn't work with capability pointers, but we're not
concerned about that here; even MTE (on aarch64) would be ok because the
alignment used matches the tag granule size.

So I'm pretty sure this is a false positive.  But perhaps we should just
disable the vectorized scanning when valgrind checking is enabled.

Note that glibc implementations of str* functions can perform a similar trick,
but perhaps valgrind has special knowledge of such cases.

  parent reply	other threads:[~2024-01-02 14:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 16:39 [Bug target/113045] New: " dcb314 at hotmail dot com
2023-12-16 16:44 ` [Bug target/113045] " pinskia at gcc dot gnu.org
2023-12-17 17:35 ` dcb314 at hotmail dot com
2023-12-17 18:18 ` redi at gcc dot gnu.org
2023-12-17 18:21 ` redi at gcc dot gnu.org
2023-12-17 18:50 ` dcb314 at hotmail dot com
2023-12-17 18:57 ` dcb314 at hotmail dot com
2023-12-17 19:55 ` dcb314 at hotmail dot com
2023-12-17 20:06 ` pinskia at gcc dot gnu.org
2023-12-17 20:11 ` pinskia at gcc dot gnu.org
2023-12-17 21:05 ` redi at gcc dot gnu.org
2023-12-17 22:22 ` redi at gcc dot gnu.org
2023-12-17 22:25 ` redi at gcc dot gnu.org
2023-12-18  8:18 ` rguenth at gcc dot gnu.org
2023-12-19  8:23 ` dcb314 at hotmail dot com
2023-12-19  8:28 ` dcb314 at hotmail dot com
2023-12-19  9:22 ` redi at gcc dot gnu.org
2023-12-19 12:58 ` mark at gcc dot gnu.org
2023-12-19 16:53 ` dcb314 at hotmail dot com
2023-12-19 17:18 ` mark at gcc dot gnu.org
2024-01-02 14:40 ` rearnsha at gcc dot gnu.org [this message]
2024-01-02 14:49 ` rearnsha at gcc dot gnu.org
2024-01-02 15:05 ` dcb314 at hotmail dot com
2024-01-02 15:14 ` schwab@linux-m68k.org
2024-01-02 15:18 ` rearnsha at gcc dot gnu.org
2024-01-02 16:25 ` mark at gcc dot gnu.org
2024-01-02 16:28 ` rearnsha at gcc dot gnu.org
2024-01-02 16:35 ` rearnsha at gcc dot gnu.org
2024-01-02 17:23 ` rearnsha at gcc dot gnu.org

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=bug-113045-4-EqWDUR9hX7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).