public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/63991] New: redundant read when write to volatile member of packed structure
@ 2014-11-20 11:07 potrepalov@asc-ural.ru
  2014-11-20 12:06 ` [Bug middle-end/63991] " rguenth at gcc dot gnu.org
  2014-11-22 11:58 ` ebotcazou at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: potrepalov@asc-ural.ru @ 2014-11-20 11:07 UTC (permalink / raw)
  To: gcc-bugs

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
----------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-22 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 11:07 [Bug c/63991] New: redundant read when write to volatile member of packed structure potrepalov@asc-ural.ru
2014-11-20 12:06 ` [Bug middle-end/63991] " rguenth at gcc dot gnu.org
2014-11-22 11:58 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).