public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45235]  New: const volatile read moved out of order
@ 2010-08-09 11:56 bigotp at acm dot org
  2010-08-09 11:57 ` [Bug rtl-optimization/45235] " bigotp at acm dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: bigotp at acm dot org @ 2010-08-09 11:56 UTC (permalink / raw)
  To: gcc-bugs

This example is reduced from hardware-specific code that uses memory-mapped
registers to control and sample a logical signal.  The read of the input signal
is moved to follow the clear of the output signal, in violation of the
requirements for volatile memory access.

Reproduce with:  gcc -S -O2 ira-bug.c

Examine the generated assembly code to verify the read of in has moved to
follow the second write of out within the loop body.

The presence of the const qualifier on the in variable enables the bug; if the
qualifier is removed the original order is retained.


volatile const short int in;
volatile short int out;

void func () {
  short int value;
  do {
    out |= 2;
    value = in;
    out &= ~2;
  } while (value & 1);
}


-- 
           Summary: const volatile read moved out of order
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bigotp at acm dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

end of thread, other threads:[~2011-12-15  0:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-45235-4@http.gcc.gnu.org/bugzilla/>
2010-12-31 17:57 ` [Bug rtl-optimization/45235] const volatile read moved out of order bigotp at acm dot org
2011-01-11 15:42 ` rguenth at gcc dot gnu.org
2011-01-11 15:44 ` rguenth at gcc dot gnu.org
2011-12-15  0:40 ` pinskia at gcc dot gnu.org
2010-08-09 11:56 [Bug rtl-optimization/45235] New: " bigotp at acm dot org
2010-08-09 11:57 ` [Bug rtl-optimization/45235] " bigotp at acm dot org
2010-08-09 13:56 ` rguenth at gcc dot gnu dot org
2010-08-11 21:41 ` pinskia at gcc dot gnu dot org
2010-08-11 22:55 ` bigotp at acm dot org
2010-08-11 23:11 ` rguenth at gcc dot gnu dot 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).