Hi Chun Yeow,

I just tried to reproduce your issue with RTcfg. As I do not have a
target to test yet, I tried a synthetic test first, see below. What
output does compiling that code with your compiler? I tried both with
some TimeSys toolchain and latest from CodeSourcery. The former fails on
Gilles' pattern, the latter passes all tests without complaints.

Jan

PS: Will now try to integrate your AT91 driver _really_ soon :) - once
I have a full build environment (kernel, Xenomai, RTnet) running.

--

typedef unsigned char u8;
typedef unsigned short u16;

#define __BIG_ENDIAN_BITFIELD

struct rtcfg_frm_head {
#if defined(__LITTLE_ENDIAN_BITFIELD)
    u8 id:5,
       version:3;
#elif defined(__BIG_ENDIAN_BITFIELD)
    u8 version:3,
       id:5;
#else
    #error unsupported byte order
#endif
} __attribute__((packed));

struct rtcfg_frm_announce {
    struct rtcfg_frm_head head;
    u8                    addr_type;
    u8                    addr[0];
    u8                    flags;
    u8                    burstrate;
} __attribute__((packed));

struct rtcfg_frm_announce2 {
    struct rtcfg_frm_head head;
    u8                    addr_type;
    u8                    flags;
    u8                    burstrate;
} __attribute__((packed));

struct rtcfg_frm_stage_1_cfg {
    struct rtcfg_frm_head head;
    u8                    addr_type;
    u8                    client_addr[0];
    u8                    server_addr[0];
    u8                    burstrate;
    u16                   cfg_len;
    u8                    cfg_data[0];
} __attribute__((packed));

struct rtcfg_frm_stage_1_cfg2 {
    struct rtcfg_frm_head head;
    u8                    addr_type;
    u8                    burstrate;
    u16                   cfg_len;
} __attribute__((packed));

struct foo {
        struct a {
                char b;
        } /*__attribute__((packed))*/ c;
        char d;
        short e;
} __attribute__((packed));

struct bar {
        char a;
} __attribute__((packed));

struct qux {
        struct bar b;
        char c;
        short d;
} __attribute__((packed));

int main()
{
        char c[1 - 2 *(sizeof(struct rtcfg_frm_announce) - sizeof(struct 
rtcfg_frm_announce2))];
        char d[1 - 2 *(sizeof(struct rtcfg_frm_stage_1_cfg) - sizeof(struct 
rtcfg_frm_stage_1_cfg2))];
        char e[1 - 2 *(sizeof(struct foo) - sizeof(struct qux))];

        c[0] = 0;
        d[0] = 0;
        e[0] = 0;

        return 0;
}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
RTnet-users mailing list
RTnet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rtnet-users

Reply via email to