https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69549
--- Comment #12 from jwjagersma at gmail dot com --- (In reply to Xi Ruoyao from comment #11) > Generally a patch should be sent to gcc-patc...@gcc.gnu.org. See > https://gcc.gnu.org/contribute.html. The patches attached to a Bugzilla > ticket are considered prototypes and for discussion only. This patch isn't complete yet, I posted it here in hopes of receiving some comments. It works for simple structs that are managed externally (eg, from inline asm). But other than that it doesn't integrate with the C++ type system so well. There is no way to make AS-qualified ctors/dtors (in fact, calling a dtor on an AS-qualified ptr/ref is currently allowed - that's very bad), and also no placement-new for AS-qualified pointers. Granted, I don't think clang implements that either, but it does provide stuff like __builtin_memcpy(). That is missing from this patch. I also recall running into one bug where it generated code to access a stack variable via fs:[esp]. I think it was something to do with rvalue references? But it disappeared when I attempted to write a smaller test case, couldn't figure that one out.