Created attachment 25393
reduced test case
> cat pr50565.c
/* pr50565.c */
struct netmessage {
unsigned char pos[2];
};
static struct netmessage nmsgbuf;
const int offset0 = (int)((void*)&nmsgbuf.pos[0] - (void*)&nmsgbuf) + 0*(1U);
const int offset1 = (int)((void*)&nmsgbuf.pos[0] - (void*)&nmsgbuf) + 1*(1U);
> objdir/gcc/xgcc -Bobjdir/gcc/ -O2 -S pr50565.c
pr50565.c:7: error: initializer element is not computable at load time
That's the offset1 initializer it's complaining about. Note that the
offset0 initializer is accepted. If we comment out the offset1
definition we get:
> perl -pi -e 's,^const int offset1,//const int offset1,g' pr50565.c
> objdir/gcc/xgcc -Bobjdir/gcc/ -O2 -S pr50565.c
> cat pr50565.s
.file "pr50565.c"
.globl offset0
.section .rodata
.align 4
.type offset0, @object
.size offset0, 4
offset0:
.long 0
.local nmsgbuf
.comm nmsgbuf,2,1
.ident "GCC: (GNU) 4.5.0 20090329 (experimental)"
.section .note.GNU-stack,"",@progbits
The common offsetof emulation is clearly computable at compile-time, so
one would expect the same + 1 to also be computable at compile-time, but
gcc doesn't seem to think so.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/771087
Title:
mmpong version 0.9.1-1 failed to build on amd64 with GCC-4.6/oneiric
To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/771087/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs