[Bug fortran/63247] fortran array alignment in omp target map
tschwinge at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 12 18:17:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63247
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |openmp
CC| |tschwinge at gcc dot gnu.org
Version|unknown |5.0
--- Comment #1 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Actually, here is a C test case that exhibits the problem on x86 (which has a
flag to switch on alignment checking), with OpenMP using the non-shared memory
host plugin. Need to build with -O, as otherwise there will be other alignment
errors. This is probably too fragile for any test suite usage, though.
#include <stdlib.h>
int
main(int argc, char **argv)
{
#define N 4
short a[N];
a[0] = 10;
a[1] = 10;
a[2] = 10;
a[3] = 10;
#pragma omp target map(a[1:N-1])
{
__asm__("pushf\norl $(1<<18),(%rsp)\npopf");
a[1] = 51;
a[2] = 52;
a[3] = 53;
__asm__("pushf\nandl $(~(1<<18)),(%rsp)\npopf");
}
if (a[0] != 10)
abort ();
if (a[1] != 51)
abort ();
if (a[2] != 52)
abort ();
if (a[3] != 53)
abort ();
return 0;
}
$ gdb -q ./a.out
Reading symbols from ./a.out...done.
(gdb) r
Starting program: [...]/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGBUS, Bus error.
0x000000000040080e in main._omp_fn.0 (.omp_data_i=0x6020c0) at
source-gcc/libgomp/testsuite/libgomp.c/pointer-align-1.c:19
19 a[1] = 51;
(gdb) disassemble
Dump of assembler code for function main._omp_fn.0:
0x0000000000400801 <+0>: pushfq
0x0000000000400802 <+1>: orl $0x40000,(%rsp)
0x0000000000400809 <+8>: popfq
0x000000000040080a <+9>: mov 0x8(%rdi),%rax
=> 0x000000000040080e <+13>: mov (%rax),%rax
0x0000000000400811 <+16>: movw $0x33,0x2(%rax)
0x0000000000400817 <+22>: mov 0x8(%rdi),%rax
0x000000000040081b <+26>: mov (%rax),%rax
0x000000000040081e <+29>: movw $0x34,0x4(%rax)
0x0000000000400824 <+35>: mov 0x8(%rdi),%rax
0x0000000000400828 <+39>: mov (%rax),%rax
0x000000000040082b <+42>: movw $0x35,0x6(%rax)
0x0000000000400831 <+48>: pushfq
0x0000000000400832 <+49>: andl $0xfffbffff,(%rsp)
0x0000000000400839 <+56>: popfq
0x000000000040083a <+57>: retq
End of assembler dump.
(gdb) info registers rax
rax 0x6020d6 6299862
More information about the Gcc-bugs
mailing list