The code compiles under gcc 4.4 with the following command
gcc -fms-extensions experiment.c
Under gcc 4.6 I get errors
#include <stdio.h>
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef signed char sint8_t;
typedef signed short sint16_t;
typedef union raw_16_bits_entry
{
uint16_t raw;
sint16_t sraw;
uint8_t byte[2];
struct
{
uint8_t blow;
uint8_t bhigh;
} __attribute__((packed));
} __attribute__((packed)) raw16_t;
typedef union raw_msr_entry
{
struct
{
uint8_t eax;
uint8_t edx;
} __attribute__((packed));
raw16_t;
} __attribute__((packed)) msr_t;
typedef union amd_syscfg_msr
{
struct
{
uint16_t rsv0:4;
uint16_t mfde:1;
uint16_t mfdm:1;
uint16_t mvdm:1;
uint16_t tom2:1;
} __attribute__((packed));
msr_t;
raw16_t;
} __attribute__((packed)) amd_syscfg_msr_t;
int main()
{
amd_syscfg_msr_t q;
q.rsv0=5;
q.raw=7;
printf("hello world!");
};
Under gcc 4.6 I get errors with -fms-extensions
exp1.c:15:13: error: duplicate member ‘raw’
exp1.c:16:13: error: duplicate member ‘sraw’
exp1.c:17:13: error: duplicate member ‘byte’
exp1.c:22:15: error: duplicate member ‘blow’
exp1.c:23:15: error: duplicate member ‘bhigh’
exp1.c: In function ‘main’:
exp1.c:66:6: error: ‘amd_syscfg_msr_t’ has no member named ‘raw’
without -fms-extensions
exp1.c:38:11: warning: declaration does not declare anything [enabled by default]
exp1.c:56:9: warning: declaration does not declare anything [enabled by default]
exp1.c:57:11: warning: declaration does not declare anything [enabled by default]
exp1.c: In function ‘main’:
exp1.c:66:6: error: ‘amd_syscfg_msr_t’ has no member named ‘raw’
I can not find any compiler options that will help.