public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/28572] Misaligned accesses in test-memcpy and test-mempcpy on hppa
Date: Thu, 11 Nov 2021 20:05:50 +0000	[thread overview]
Message-ID: <bug-28572-131-505Tt9B5ya@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28572-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28572

--- Comment #12 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
The misaligned access come from string/test-memcpy-support.h, which uses the
input alignment to create 'uint32_t*' pointers.  This is the issue we should
fix for this bug report, but I don't think the patch proposed is the best
approach. I think the following should work, but I did not tested on machine
that does not support unaligned access:

diff --git a/string/test-memcpy-support.h b/string/test-memcpy-support.h
index 419158a420..69c983957f 100644
--- a/string/test-memcpy-support.h
+++ b/string/test-memcpy-support.h
@@ -141,7 +141,7 @@ do_test1 (size_t align1, size_t align2, size_t size)
   for (repeats = 0; repeats < 2; repeats++)
     {
       for (i = 0; i < array_size; i++)
-        src[i] = (uint32_t)i;
+        memcpy (&src[i], & (uint32_t){i}, sizeof (uint32_t));
       FOR_EACH_IMPL (impl, 0)
       {
         memset (dest, -1, size);
@@ -149,7 +149,7 @@ do_test1 (size_t align1, size_t align2, size_t size)
         if (memcmp (src, dest, size))
           {
             for (i = 0; i < array_size; i++)
-              if (dest[i] != src[i])
+             if (memcmp (&dest[i], &src[i], sizeof (uint32_t)) != 0)
                 {
                   error (0, 0,
                          "Wrong result in function %s dst \"%p\" src \"%p\" "


For the test-memcpy taking too much time, I think we should track it on another
bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-11-11 20:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 17:32 [Bug libc/28572] New: " danglin at gcc dot gnu.org
2021-11-09 17:42 ` [Bug libc/28572] " adhemerval.zanella at linaro dot org
2021-11-09 20:56 ` dave.anglin at bell dot net
2021-11-11 17:02 ` danglin at gcc dot gnu.org
2021-11-11 17:17 ` danglin at gcc dot gnu.org
2021-11-11 17:25 ` danglin at gcc dot gnu.org
2021-11-11 17:39 ` goldstein.w.n at gmail dot com
2021-11-11 17:53 ` dave.anglin at bell dot net
2021-11-11 18:22 ` goldstein.w.n at gmail dot com
2021-11-11 18:27 ` goldstein.w.n at gmail dot com
2021-11-11 19:50 ` hjl.tools at gmail dot com
2021-11-11 19:52 ` goldstein.w.n at gmail dot com
2021-11-11 20:03 ` hjl.tools at gmail dot com
2021-11-11 20:04 ` goldstein.w.n at gmail dot com
2021-11-11 20:05 ` adhemerval.zanella at linaro dot org [this message]
2021-11-11 20:05 ` dave.anglin at bell dot net
2021-11-11 20:24 ` dave.anglin at bell dot net
2021-11-11 20:30 ` goldstein.w.n at gmail dot com
2021-11-11 20:31 ` goldstein.w.n at gmail dot com
2021-11-12 14:51 ` danglin at gcc dot gnu.org
2021-12-08  4:21 ` goldstein.w.n at gmail dot com
2021-12-08 14:11 ` dave.anglin at bell dot net
2022-01-05 13:39 ` hjl.tools at gmail dot com

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-28572-131-505Tt9B5ya@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).