Re: [tip:x86/urgent 1/1] arch/x86/coco/sev/core.c:2170:30: warning: variable 'dummy' set but not used
From: Nathan Chancellor
Date: Tue Jul 01 2025 - 11:11:25 EST
On Mon, Jun 30, 2025 at 09:27:26PM +0200, Borislav Petkov wrote:
> On Tue, Jul 01, 2025 at 02:43:31AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent
> > head: 4a35d2b5254af89595fd90dae9ee0c8f990a148d
> > commit: 4a35d2b5254af89595fd90dae9ee0c8f990a148d [1/1] x86/sev: Use TSC_FACTOR for Secure TSC frequency calculation
> > config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250701/202507010218.3O5Ge0Xt-lkp@xxxxxxxxx/config)
> > compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
>
> Pff, doesn't fire with clang-19.
>
> That damn compiler.
>
> gcc used to complain about those but they fixed their interprocedural analysis
> or whatnot.
>
> clang is simply complaining more.
Citation needed. This reproduces with Clang 15 (earliest supported on
x86 now), Clang 19, and GCC 15 for me. Were you missing W=1?
$ x86_64-linux-gcc --version | head -1
x86_64-linux-gcc (GCC) 15.1.0
$ curl -LSso .config https://download.01.org/0day-ci/archive/20250701/202507010218.3O5Ge0Xt-lkp@xxxxxxxxx/config
$ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- W=1 olddefconfig arch/x86/coco/sev/core.o
arch/x86/coco/sev/core.c: In function 'snp_secure_tsc_init':
arch/x86/coco/sev/core.c:2170:37: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
2170 | unsigned long tsc_freq_mhz, dummy;
| ^~~~~
Cheers,
Nathan