This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70178] Loop-invariant memory loads from std::string innards are not hoisted
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 11 Mar 2016 08:53:25 +0000
- Subject: [Bug c++/70178] Loop-invariant memory loads from std::string innards are not hoisted
- Auto-submitted: auto-generated
- References: <bug-70178-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70178
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is because we don't know that for
struct string { char *data; } s;
s->data doesn't point to &s->data and thus writing to s->data[i] may invalidate
the pointer. Unfortunately 'char' aliases everything so writing to a char *
object and then reading back as char * is valid from a TBAA perspective.