http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45351
--- Comment #10 from Jay <jay.krell at cornell dot edu> 2011-07-19 15:58:04 UTC
---
>> Is there no annotation in /usr/include/whatever.h to get the required
>> alignment? Maybe that gcc doesn't-but-maybe-should understand?
>
> No, the section I cited is all there is. No idea why this error doesn't
> show up otherwise.
Do struct alignment rules on Tru64 have an effect? Not that I
looked-up/read the ABI details..
I'm not sure I have Tru64 access any longer (and my
time/work/money-to-burn has dramatically declined, sorry, it was fun!)
But I'd be curious what this does:
#include something
#include stddef.h
int main()
{
typedef struct { char a; sem_t b; } t1;
printf("%u %u\n", sizeof(t1), offsetof(t1, b));
return 0;
}
5 or 6 or 8 or other?
and 1 or 2 or 4 or other?
If the alignment is really only 2, then I'd expect 6 and 2.
If the alignment is somehow bumped up, then 8 and 4.
The code cited does seem poor.
Personally I'm a big fan of memset(p, 0, n) (or #define ZeroMemory(p, n)).
- Jay