Testcase: #include <stdlib.h> #include <stdio.h> struct Tst { unsigned char data[1]; };
int main(void) { struct Tst *tst = malloc(sizeof(struct Tst) + 10); unsigned char *tmp = tst->data; tst->data[0] = 0; tmp[0] = 1; tmp[1] = 2; printf("%x %x\n", tmp[0], tmp[1]); printf("%x %x\n", tst->data[0], tst->data[1]); printf("%p %p\n", &tmp[0], &tmp[1]); printf("%p %p\n", &tst->data[0], &tst->data[1]); return 0; } Produces on x86_64 (Dell PC, Core 2 Duo) 1 2 1 2 0x601010 0x601011 0x601010 0x601011 Produces on alpha (DS10, EV67, Fedora 8) 1 2 1 1 0x120012010 0x120012011 0x120012010 0x120012011 Produces on ia64 (SLES 10.1) 1 2 1 2 0x6000000000004010 0x6000000000004011 0x6000000000004010 0x6000000000004011 If you need access to an alpha, I can arrange this! Sorry, if the component is wrong. -- Summary: gcc bug on alpha Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: oliver at linux-kernel dot at GCC build triplet: alpha-redhat-linux GCC host triplet: alpha-redhat-linux GCC target triplet: alpha-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36004