https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64567
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Rasmus Villemoes from comment #2) > (In reply to Andreas Schwab from comment #1) > > This transformation is incorrect if the lvalue may be pointing to a > > read-only object. > > True. And one may also incur an extra cache penalty if the cache line > containing foo was already held shared but not exclusive. Or incorrect due to C11/C++11 memory model. Anyways it is correct for scalar auto variables and this should be transformed at the gimple level if not already.