[Bug c/27628] New: Incorrect memory access type used used in accessing bitfields

2006-05-16 Thread ryan at embedded-iq dot com
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



[Bug c/27628] Incorrect memory access type used used in accessing bitfields

2006-05-16 Thread ryan at embedded-iq dot com


--- Comment #2 from ryan at embedded-iq dot com  2006-05-16 15:54 ---
Subject: RE:  Incorrect memory access type used used in accessing bitfields

Hi Falk,

Thanks for your reply. Any idea with what release PR 23623 will be fixed?
4.3.0?

Regards,
Ryan

-Original Message-
From: falk at debian dot org [mailto:[EMAIL PROTECTED] 
Sent: 16 May 2006 02:40 PM
To: [EMAIL PROTECTED]
Subject: [Bug c/27628] Incorrect memory access type used used in accessing
bitfields



--- Comment #1 from falk at debian dot org  2006-05-16 12:40 ---
There is no guarantee that this happens, and it would suppress many useful
optimizations.

However, if you mark the fields as volatile, the ARM ABI guarantees that
the access will be in the specified width (and after PR 23623 has been
fixed,
gcc should follow this).


-- 

falk at debian dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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

--- You are receiving this mail because: ---
You reported the bug, or are watching the reporter.


-- 


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