This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/45819] [4.5 Regression] unexpected unaligned access to volatile int


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

Khem Raj <raj.khem at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |raj.khem at gmail dot com

--- Comment #9 from Khem Raj <raj.khem at gmail dot com> 2011-06-09 06:47:01 UTC ---
here is another testcase which generates loadbytes with gcc 4.6 but works as
expected with gcc 4.5 on arm. gcc are latest from respective branches. and it
fails irrespective of having -fstrict-volatile-bitfields or not.

struct ehci_regs {                                                              
char x;                                                                         
unsigned int port_status[0];                                                    
} __attribute__ ((packed));                                                     
//} __attribute__ ((packed,aligned(__alignof__(int))));                         

struct ehci_hcd{                                                                
struct ehci_regs *regs;                                                         
};                                                                              

int ehci_hub_control (                                                          
 struct ehci_hcd *ehci,                                                         
 int wIndex                                                                     
) {                                                                             
 unsigned int *status_reg = &ehci->regs->port_status[wIndex];                   
 return *(volatile unsigned int *)status_reg;                                   
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]