struct
{
   unsigned int b : 1;
} bf1;

volatile struct
{
   unsigned int b : 1;
} bf2;

void test(void)
{
   bf1.b = 1;
   bf2.b = 1;
}

Access to bf1.b is correctly done as 32-bits (lwz/stw opcodes), bf2.b is
accessed as 8-bits (lbz/stb opcodes). GCC3.4.3 shows the same behaviour, can't
go back any further. The same happens when the bitfield itself is made volatile,
not the whole struct.

-- 
           Summary: volatile keyword changes bitfield access size from 32bit
                    to 8bit
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: m dot reszat at kostal dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-cygwin
GCC target triplet: powerpc-elf-eabispe


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

Reply via email to