From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41ECB385781C; Thu, 11 Nov 2021 20:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41ECB385781C From: "adhemerval.zanella at linaro dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: adhemerval.zanella at linaro dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: glibc-bugs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-bugs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2021 20:05:50 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28572 --- Comment #12 from Adhemerval Zanella --- 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 =3D 0; repeats < 2; repeats++) { for (i =3D 0; i < array_size; i++) - src[i] =3D (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 =3D 0; i < array_size; i++) - if (dest[i] !=3D src[i]) + if (memcmp (&dest[i], &src[i], sizeof (uint32_t)) !=3D 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 ano= ther bug. --=20 You are receiving this mail because: You are on the CC list for the bug.=