This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/45235] const volatile read moved out of order



------- Comment #4 from bigotp at acm dot org  2010-08-11 22:54 -------
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?  (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.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]