From: Tom de Vries <tdevries@suse.de>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.arch/i386-avx.exp with clang
Date: Fri, 5 Nov 2021 10:43:38 +0100 [thread overview]
Message-ID: <b5f07399-d1a1-1a60-05bb-6d7f172b41ab@suse.de> (raw)
In-Reply-To: <20211105093300.GG918204@redhat.com>
On 11/5/21 10:33 AM, Andrew Burgess wrote:
> * Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> [2021-11-04 14:55:59 +0100]:
>
>> When running test-case gdb.arch/i386-avx.exp with clang I ran into:
>> ...
>> (gdb) PASS: gdb.arch/i386-avx.exp: set first breakpoint in main
>> continue^M
>> Continuing.^M
>> ^M
>> Program received signal SIGSEGV, Segmentation fault.^M
>> 0x000000000040052b in main (argc=1, argv=0x7fffffffd3c8) at i386-avx.c:54^M
>> 54 asm ("vmovaps 0(%0), %%ymm0\n\t"^M
>> (gdb) FAIL: gdb.arch/i386-avx.exp: continue to breakpoint: \
>> continue to first breakpoint in main
>> ...
>>
>> The problem is that the vmovaps insn requires an 256-bit (or 32-byte aligned
>> address), and it's only 16-byte aligned:
>> ...
>> (gdb) p /x $rax
>> $1 = 0x601030
>> ...
>>
>> Fix this by copying to a sufficiently aligned address.
>>
>> Tested on x86_64-linux, with both gcc and clang.
>> ---
>> gdb/testsuite/gdb.arch/i386-avx.c | 28 +++++++++++++++++++++++++++-
>> 1 file changed, 27 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c
>> index 4e938399a24..9b5323f9f76 100644
>> --- a/gdb/testsuite/gdb.arch/i386-avx.c
>> +++ b/gdb/testsuite/gdb.arch/i386-avx.c
>> @@ -18,6 +18,9 @@
>> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>>
>> #include <stdio.h>
>> +#include <stdint.h>
>> +#include <assert.h>
>> +#include <string.h>
>> #include "nat/x86-cpuid.h"
>>
>> typedef struct {
>> @@ -25,7 +28,7 @@ typedef struct {
>> } v8sf_t;
>>
>>
>> -v8sf_t data[] =
>> +v8sf_t data_orig[] =
>
> I see the same problem. Did you consider using:
>
> /* Some useful comment .... */
> v8sf_t data[] __attribute__ ((aligned(32))) = ....
>
> this seems to fix the problem on clang for me, and still works fine
> with gcc.
I did consider this, and decided against it because it's not portable.
Note btw that there is no other usage of this:
...
$ find gdb/testsuite/ -type f | xargs grep attribute.*align
$
...
Btw, I now realize that gdb.arch/i386-sse.exp has the same issue, I'll
try to factor out a solution that can used in both test-cases.
Thanks,
- Tom
next prev parent reply other threads:[~2021-11-05 9:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 13:55 Tom de Vries
2021-11-05 9:33 ` Andrew Burgess
2021-11-05 9:43 ` Tom de Vries [this message]
2021-11-05 11:54 ` Andrew Burgess
2021-11-05 12:23 ` Tom de Vries
2021-11-05 12:55 ` Pedro Alves
2021-11-05 13:15 ` Tom de Vries
2021-11-05 13:20 ` Pedro Alves
2021-11-05 13:35 ` Tom de Vries
2021-11-05 13:52 ` Andrew Burgess
2021-12-06 15:27 ` Tom de Vries
2021-11-05 13:54 ` Pedro Alves
2021-12-06 15:25 ` Tom de Vries
2021-11-05 12:24 ` Pedro Alves
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=b5f07399-d1a1-1a60-05bb-6d7f172b41ab@suse.de \
--to=tdevries@suse.de \
--cc=aburgess@redhat.com \
--cc=gdb-patches@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).