I have the following tagged union in my code: https://github.com/EarlGray/SECD/blob/f2e364f84d194aea5cef9257630bf931e9f88cab/secd.h#L217
When I compile it on 64 bit Linux or OS X using gcc or clang, size of cell_t
is always 32 bytes (4 * sizeof(long)
, as expected).
When I compile it on Linux (Ubuntu 14.04, gcc 4.8) using -m32
switch, the size is 16 bytes (as expected).
When I compile the same code on OS X (10.9.5) using either gcc (4.8) or clang (Apple 6.0) with -m32
, the size is 20 bytes. I tried to debug the program and to see if there are any union cases that might use the fifth word, haven't found any. It does not depend on levels of optimization and debug information presence.
Any ideas why sizeof(cell_t)
is 20 bytes?