aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/i386-sse.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-12-06 16:01:47 +0100
committerTom de Vries <tdevries@suse.de>2021-12-06 16:01:47 +0100
commit197a63068b10d50c01fbe024a45d47cd25a907e3 (patch)
treed4bfe298f6e544518ec001b952ff555ecbf78396 /gdb/testsuite/gdb.arch/i386-sse.c
parentf21dbd7c8038acee8ece4d57f2454083c37e98f6 (diff)
downloadgdb-197a63068b10d50c01fbe024a45d47cd25a907e3.zip
gdb-197a63068b10d50c01fbe024a45d47cd25a907e3.tar.gz
gdb-197a63068b10d50c01fbe024a45d47cd25a907e3.tar.bz2
[gdb/testsuite] Fix data alignment in gdb.arch/i386-{avx,sse}.exp
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 using a sufficiently aligned address, using _Alignas. Compile using -std=gnu11 to support _Alignas. Likewise in gdb.arch/i386-sse.exp. Tested on x86_64-linux, with both gcc and clang.
Diffstat (limited to 'gdb/testsuite/gdb.arch/i386-sse.c')
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c
index a5941a4..10bd4b6 100644
--- a/gdb/testsuite/gdb.arch/i386-sse.c
+++ b/gdb/testsuite/gdb.arch/i386-sse.c
@@ -20,8 +20,11 @@
#include <stdio.h>
#include "nat/x86-cpuid.h"
+/* Align sufficient to be able to use movaps. */
+#define ALIGN 16
+
typedef struct {
- float f[4];
+ _Alignas (ALIGN) float f[4];
} v4sf_t;