[Bug tree-optimization/93971] std::string considered to alias declared objects of incompatible types

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 29 08:01:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93971

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
It has never been very clear to me what restrict means on a struct member, but
I believe adding it to the pointer in vector means that in a function:
void f(vector*a, vector*b)
the compiler could assume that a->data and b->data don't alias even if b turns
out to be equal to a? (plus we would need to replace finish and end_of_storage
with lengths so they don't alias start)

The semantics we would want seem more like: pretend that the allocated region
is an extra member of the class, so they alias iff the class objects are the
same?


More information about the Gcc-bugs mailing list