When specifying a bitfield type, the compiler should generate assembly language
instructions that honor that type.

For example, with the following structure, 

typedef struct {
   unsigned long  bitfA: 8;
   unsigned long  bitfB: 8;
   unsigned long  bitfC: 8;
   unsigned long  bitfD: 8;
} MYSTRUCT;

the compiler should only attempt to access the bitfields using 32 bit accesses
(on the ARM, this would be using LDR & STR instructions). What I actually get
is that the compiler will try to access these bitfields using LDRB & STRB
(8-bit accesses). On some targets, only one type of access is allowed to
certain memory areas, so an error results.

Using built-in specs.
Target: arm-elf
Configured with: ../gcc-4.1.0/configure --target=arm-elf
--prefix=/g/gnuarm-4.1.0 --enable-interwork --enable-multilib --with-float=soft
--with-newlib --with-he
aders=../newlib-1.14.0/newlib/libc/include --enable-languages=c,c++
Thread model: single
gcc version 4.1.0


-- 
           Summary: Incorrect memory access type used used in accessing
                    bitfields
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ryan at embedded-iq dot com


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

Reply via email to