special_insns.h:36:9: error: array subscript 0 is outside array bounds of ‘unsigned int[0]’ [-Werror=array-bounds]

From: Bruno Goncalves
Date: Wed Apr 06 2022 - 12:51:56 EST


Hello,

Trying to build mainline kernel with gcc12 and selftests we get the
following error:

00:01:22 In function ‘native_read_cr2’,
00:01:22 inlined from ‘vmx_vcpu_enter_exit’ at
arch/x86/kvm/vmx/vmx.c:6772:24:
00:01:22 ./arch/x86/include/asm/special_insns.h:36:9: error: array
subscript 0 is outside array bounds of ‘unsigned int[0]’
[-Werror=array-bounds]
00:01:22 36 | asm volatile("mov %%cr2,%0\n\t" : "=r" (val)
: __FORCE_ORDER);
00:01:22 | ^~~
00:01:22 In function ‘native_read_cr2’,
00:01:22 inlined from ‘vmx_vcpu_enter_exit’ at
arch/x86/kvm/vmx/vmx.c:6778:19:
00:01:22 ./arch/x86/include/asm/special_insns.h:36:9: error: array
subscript 0 is outside array bounds of ‘unsigned int[0]’
[-Werror=array-bounds]
00:01:22 36 | asm volatile("mov %%cr2,%0\n\t" : "=r" (val)
: __FORCE_ORDER);
00:01:22 | ^~~
00:01:22 cc1: all warnings being treated as errors
00:01:22 make[4]: *** [scripts/Makefile.build:288:
arch/x86/kvm/vmx/vmx.o] Error 1
00:01:22 make[3]: *** [scripts/Makefile.build:550: arch/x86/kvm] Error 2


Full build log:
https://s3.us-east-1.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2022/04/05/509694021/build_x86_64_redhat:2295283495/build.log

build config: https://s3.us-east-1.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2022/04/05/509694021/build_x86_64_redhat:2295283495/kernel-mainline.kernel.org-x86_64-3e732ebf7316ac83e8562db7e64cc68aec390a18.config

Thanks,
Bruno Goncalves