AnsweredAssumed Answered

Qorivva: sizeof a structure with bitfields

Question asked by Pascal BRAND on Sep 21, 2017

Hello,

 

Using CodeWarrior for MCU, v10.7, on Qorivva target, I am not able to understand the size of the current structures: S1 has size 1 (not expected - I was expecting 4, following the section "21.4.6 Bitfields" of the documentation MCU_Power-Architecture_Compiler.pdf), wheras S2 has size 4 (as expected):

 

    struct S1 {
        unsigned int a: 4;
        unsigned int b: 3;
        unsigned char c:1;
    };

    struct S2 {
        unsigned char c:1;
        unsigned int a: 4;
        unsigned int b: 3;
    };

 

Could you elaborate?

 

Thanks for your support,

Pascal.

 

PS: I have attached the project to highlight it.

Original Attachment has been moved to: MPC-C.7z.zip

Outcomes