[Bug c++/87373] Packed structs are not handled properly on ARM architecture even with misaligned access is enabled
murat.ursavas at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 29 20:19:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87373
--- Comment #31 from Murat Ursavaş <murat.ursavas at gmail dot com> ---
(In reply to Murat Ursavaş from comment #28)
>
> Here's the disassembly of a problematic part:
>
> 4.9.3
>
> 121 NVM_SPI->ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN |
> USART_ROUTE_CLKPEN | NVM_SPI_LOCATION;
> 00029e38: ldr r3,[pc,#0x4c] ; 0x29e84
> 00029e3a: ldr r2,[r3,#0x54]
> 00029e3c: movs r2,#0x0
> 00029e3e: orr r2,r2,#0xb
> 00029e42: str r2,[r3,#0x54]
>
> 7.3.1
>
> 121 NVM_SPI->ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN |
> USART_ROUTE_CLKPEN | NVM_SPI_LOCATION;
> 0000572e: ldr r3,[pc,#0x70] ; 0x579c
> 00005730: ldrb.w r2,[r3,#0x54]
> 00005734: movs r2,#0x0
> 00005736: orr r2,r2,#0xb
> 0000573a: strb.w r2,[r3,#0x54]
> 0000573e: ldrb.w r2,[r3,#0x55]
> 00005742: movs r2,#0x0
> 00005744: strb.w r2,[r3,#0x55]
> 00005748: ldrb.w r2,[r3,#0x56]
> 0000574c: movs r2,#0x0
> 0000574e: strb.w r2,[r3,#0x56]
> 00005752: ldrb.w r2,[r3,#0x57]
> 00005756: movs r2,#0x0
> 00005758: strb.w r2,[r3,#0x57]
My limited assembler knowledge says new one is byte by byte access and should
set the register correctly, but somehow it's not.
Could actual object code be different than what I see in the disassembly? I'll
try to verify it via inspecting the code space.
More information about the Gcc-bugs
mailing list