This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/55428] -mms-bitfields hides -mno-align-double option
- From: "kasberger at heidenhain dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 26 Nov 2012 09:51:50 +0000
- Subject: [Bug target/55428] -mms-bitfields hides -mno-align-double option
- Auto-submitted: auto-generated
- References: <bug-55428-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55428
--- Comment #5 from Andreas Kasberger <kasberger at heidenhain dot de> 2012-11-26 09:51:50 UTC ---
I found this example on
geeksforgeeks.org/forum/topic/c-structure-size-with-empty-bitfield
#define offset(a,b) (size_t)(&(((a*)(0))->b))
struct emp
{
char s:8;
char c:7;
char d:2;
int:14;
char u;
char g:2;
}e;
int l;
l = offset(struct emp,u);
printf("%d %d",sizeof(struct emp),l);
With this example it is impossible to get vsc++ /zp4 results with gcc options
without changing the souce code itself.
The ms compiler result is "12 8" on gcc I will get mostly 6 4
I'm not able to align the bitfields in the way like ms do it.
Each single bitfield is aligned at word boundary.