http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56448
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org |gnu.org | --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-25 22:40:42 UTC --- Created attachment 29536 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29536 gcc48-pr56448.patch Untested fix. For OEP_CONSTANT_ADDRESS_OF, we should ignore side-effects of the reference from which the address is taken, they change the value, not its address. OEP_CONSTANT_ADDRESS_OF in flags is fine to propagate to the first operand of some references, so e.g. &a.b[0].c[9] is constant, even when c and b arrays are volatile, but not the other arguments (e.g. array indexes, etc.), but for *MEM_REF not even the first argument should get that.