http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55454
Bug #: 55454
Summary: [PPC] unaligned memory accesses do not work correctly
for vector extensions when using altivec
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
The following test program reproduces the problem:
/*******************************************************/
#include <stdint.h>
#include <assert.h>
typedef uint8_t uint8x16 __attribute__ ((vector_size(16)));
typedef struct { char dummy; uint8x16 data; } __attribute__((packed)) foo;
char __attribute__((aligned(16))) buffer[32];
void __attribute__((noinline)) init_buffer(const uint8x16 *a)
{
((foo *)(buffer + 9))->data = *a;
}
int main (void)
{
const uint8x16 a = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
assert(sizeof(foo) == 17);
init_buffer(&a);
assert(buffer[0] == 0);
return 0;
}
/*******************************************************/
$ gcc -O2 -maltivec -o test test.c
$ ./test
test: test.c:19: main: Assertion `buffer[0] == 0' failed.
Aborted