------- Comment #5 from rguenth at gcc dot gnu dot org 2010-08-11 23:11 ------- (In reply to comment #4) > I don't see that the const qualifier should be relevant: doesn't it simply > indicate that the code is not permitted to write through that lvalue?
That's true which is why I think this bug is valid. > (FWIW, > the real code uses a memory mapped address and the const qualifier was placed > on the address declaration by the chip manufacturer. I assume that a write to > the location may be interpreted as a command to the hardware to > self-destruct.) > > Given that, the existing behavior appears to be a clear violation of the > requirement that volatile accesses not be re-ordered across sequence points. > > In concept, I like rguenth's solution (which I haven't tested), as it fits > with > the documented semantics of MEM_READONLY_P indicating "not modified during the > lifetime of the program", something that certainly can't be said of any > readable volatile object. That the RTL flag is stored in a field named > "unchanging" is a lot more clear than "READONLY". I think that approach > eliminates the need to muck with any of those other places where the same > problem might be occurring. Indeed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2010-08-09 13:56:06 |2010-08-11 23:11:05 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45235