This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16721] [3.5 Regression] Accesses to volatile objects optimized away
- From: "macro at linux-mips dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jul 2004 12:50:37 -0000
- Subject: [Bug c/16721] [3.5 Regression] Accesses to volatile objects optimized away
- References: <20040726181156.16721.macro@linux-mips.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From macro at linux-mips dot org 2004-07-27 12:50 -------
(In reply to comment #3)
`info "(gcc)"Volatiles' disagrees -- despite it being mostly about C++, it
refers to GCC's behavior for C code, too. Specifically:
"[...] Less obvious expressions are where something which looks like an
access is used in a void context. An example would be,
volatile int *src = SOMEVALUE;
*src;
With C, such expressions are rvalues, and as rvalues cause a read of
the object, GCC interprets this as a read of the volatile being pointed
to. [...]"
Otherwise, what is your proposal about coding reads that must not be optimized
away due to side effects they have? The reads missing from Linux binaries due
to this bug are accesses to a DMA controller register to reset the logic at the
end of a transfer. This is the lone need for them in this context -- the value
read is not needed there for anything. There are more cases like this -- it's
just that this one was the first one I've spotted, and actually quite a critical
one as the DMA controller is used for CoW by the paging subsystem on this
platform. Others may stay hidden as the may only trigger under less common
circumstances only.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16721