[Bug c/63991] New: redundant read when write to volatile member of packed structure
potrepalov@asc-ural.ru
gcc-bugzilla@gcc.gnu.org
Thu Nov 20 11:07:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63991
Bug ID: 63991
Summary: redundant read when write to volatile member of packed
structure
Product: gcc
Version: 4.8.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: potrepalov@asc-ural.ru
There is redundant read when write to volatile member of packed structure:
exti.c:
---------------
typedef struct
{
volatile unsigned int IMR;
volatile unsigned int EMR;
volatile unsigned int RTSR;
volatile unsigned int FTSR;
volatile unsigned int SWIER;
volatile unsigned int PR;
} EXTI_TypeDef;
void
EXTI_5_IRQHandler( EXTI_TypeDef * exti ) { exti->PR = 1 << 5; }
---------------
make.bat:
---------------
arm-none-eabi-gcc -mthumb -march=armv7e-m -fpack-struct -O2 -c exti.c -o
exti-bug.o
arm-none-eabi-gcc -mthumb -march=armv7e-m -O2 -c exti.c -o exti.o
arm-none-eabi-objdump -a -S exti.o > exti.lst
arm-none-eabi-objdump -a -S exti-bug.o > exti-bug.lst
---------------
exti.lst
---------------
exti.o: file format elf32-littlearm
exti.o
Disassembly of section .text:
00000000 <EXTI_5_IRQHandler>:
0: 2320 movs r3, #32
2: 6143 str r3, [r0, #20]
4: 4770 bx lr
6: bf00 nop
----------------
exti-bug.lst
----------------
exti-bug.o: file format elf32-littlearm
exti-bug.o
Disassembly of section .text:
00000000 <EXTI_5_IRQHandler>:
0: 2320 movs r3, #32
2: 6942 ldr r2, [r0, #20]
4: 6143 str r3, [r0, #20]
6: 4770 bx lr
----------------
More information about the Gcc-bugs
mailing list