https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124821
--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> ---
[[gnu::noinline,gnu::noclone,gnu::noipa]]
extern int foo (std::string_view s)
{
char *t = (char*)s.data();
std::string *a = (std::string*)(t-2*sizeof(void*));
*a+="my long long long long string";
return 1;
}
is a valid (and well defined) definition of foo think. Yes it is a bit odd
because of the -2*sizeof(void*) but I think it is valid since the object exists
from -2*sizeof(void*)...+16.
Now you do need to know the exact layout of std::string but I don't see why
this would not be valid for some layout of std::string.