According to GCC's documentation, the only supported use for specifying registers for local variables is "to specify registers for input and output operands when calling Extended asm." Using it as a shortcut to get the value in a register isn't guaranteed to work, and clang complains that the variable is uninitialized. Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx> --- x86/vmx_tests.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 4aebc3f..565b69b 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -2138,7 +2138,9 @@ static void into_guest_main(void) .offset = (uintptr_t)&&into, .selector = KERNEL_CS32, }; - register uintptr_t rsp asm("rsp"); + uintptr_t rsp; + + asm volatile ("mov %%rsp, %0" : "=r"(rsp)); if (fp.offset != (uintptr_t)&&into) { printf("Code address too high.\n"); @@ -3221,7 +3223,9 @@ static void try_compat_invvpid(void *unused) .offset = (uintptr_t)&&invvpid, .selector = KERNEL_CS32, }; - register uintptr_t rsp asm("rsp"); + uintptr_t rsp; + + asm volatile ("mov %%rsp, %0" : "=r"(rsp)); TEST_ASSERT_MSG(fp.offset == (uintptr_t)&&invvpid, "Code address too high."); -- 2.24.0.rc1.363.gb1bccd3e3d-goog