This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/45235] New: const volatile read moved out of order
- From: "bigotp at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2010 11:56:05 -0000
- Subject: [Bug rtl-optimization/45235] New: const volatile read moved out of order
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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