Pedro Alves wrote:
I've built a cc1.exe with the attached patch applied, and I now get the
same alignments as the OP reported MSVC choses. I'm doing a full
gcc build now.
The patch also forces 64-bit alignment on doubles, but I haven't
tested it yet - bonus points if someone tests it and compares it to
MSVC.
I'm keeping the bonus points, after comparing to MSVC with the attached
test program, based on the OP's.
I've committed the patch to trunk. If you build from sources, let
me know if there are any problems left, and if it fixes the
reported problems.
For everyone else not following the discussion closelly:
This fix means the next release will break binary compatibility
with previous releases, but will be (hopefully) fully binary
compatible with the WinCE ABI.
Cheers,
Pedro Alves
#include <stdio.h>
#include <windows.h>
#ifdef __GNUC__
#define _tmain main
#define _TCHAR char
#endif
struct T1
{
unsigned short f1;
int f2;
char f3;
char f4;
};
struct T2
{
unsigned short f1;
__int64 f2;
char f3;
char f4;
};
struct T3
{
unsigned short f1;
double f2;
char f3;
char f4;
};
int _tmain(int argc, _TCHAR *argv[])
{
#define poffset(T, F) \
printf("offsetof (%s::%s) = %i\n", #T, #F, offsetof (T, F))
printf("sizeof (struct T1) = %i\n", sizeof (struct T1));
poffset(struct T1, f1);
poffset(struct T1, f2);
poffset(struct T1, f3);
poffset(struct T1, f4);
printf("sizeof (struct T2) = %i\n", sizeof (struct T2));
poffset(struct T2, f1);
poffset(struct T2, f2);
poffset(struct T2, f3);
poffset(struct T2, f4);
printf("sizeof (struct T3) = %i\n", sizeof (struct T3));
poffset(struct T3, f1);
poffset(struct T3, f2);
poffset(struct T3, f3);
poffset(struct T3, f4);
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel