It seems that gcc -fpack-struct option does not have any effect in MinGW with gcc 4.8.1-4. It used to work in old MinGW releases with gcc 4.6.
Find code piece I used for testing attached.
Output of the test code now:
bcd16 size: 32
i64 size: 8
i64 content: 4300000021
memcmp (bcd16): 0
Output of the test code should be:
bcd16 size: 8
i64 size: 8
i64 content: 6543210987654321
memcmp (int): 0
I just tried the same on Fedora Core 19, gcc-4.8.1-1-FC19. It works correctly, so gcc itself may be be fine. The issue is likely to be MinGW related.
No, I don't think so.
This looks like GCC bug #52991 -- an upstream bug. I recall some recent discussion of it, but I'm having difficulty finding the reference; this may be a duplicate. In any case, we need an upstream resolution.
Found it! It is a duplicate, of [#2005].
Related
Issues:
#2005Thank you for your help. Yep, -mno-ms-bitfields is the cure for my problem.
It may be a work around; it isn't a cure. The cure would require pressing the GCC folks to actually progress a resolution to bug #52991.