http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59734

            Bug ID: 59734
           Summary: Simple strict-volatile-bitfields case not working
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joey.ye at arm dot com

$ cat v.c
struct str {
    volatile unsigned f1: 8;
};

int foo(struct str *a)
{
    a->f1=sizeof(struct str);
}
$ arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -Os -fstrict-volatile-bitfields v.c
-S

4.6:
    ldr    r3, [r0, #0]  <= Correct. Load word
    movs    r2, #4
    bfi    r3, r2, #0, #8
    str    r3, [r0, #0]
    bx    lr

4.7:
    ldrb    r3, [r0, #0]    @ zero_extendqisi2 <= Incorrect. Load byte
    movs    r3, #4
    strb    r3, [r0, #0]
    bx    lr

4.8 and latest trunk (date 20140108, after Sandra and Bernd's fixes):
    ldrb    r3, [r0]    @ zero_extendqisi2 <= Incorrect. Load byte
    movs    r2, #4
    bfi    r3, r2, #0, #8
    strb    r3, [r0]
    bx    lr

Reply via email to