https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108968
--- Comment #16 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Minimized version of attachment 54572: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ struct cpu_info { /* [...snip...] */ struct vcpu *current_vcpu; /* [...snip...] */ }; struct vcpu { /* [...snip...] */ struct domain *domain; /* [...snip...] */ }; static __inline__ struct cpu_info *get_cpu_info_from_stack(unsigned long sp) { return (struct cpu_info *)((sp | ((((1L) << 12) << 3) - 1)) + 1) - 1; } static __inline__ struct cpu_info *get_cpu_info(void) { register unsigned long sp asm("rsp"); return get_cpu_info_from_stack(sp); } void foo(char *other) { char *ptr = ((void*)0); if ( ((get_cpu_info()->current_vcpu))->domain ) ptr = other; asm volatile ("cmc"); if ( ((get_cpu_info()->current_vcpu))->domain ) ptr[0] = ~ptr[0]; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~