sparse: Expected ) at end of cast operator, got __seg_gs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Forwarded from linux-kernel@xxxxxxxxxxxxxxx

---------- Forwarded message ---------
From: Uros Bizjak <ubizjak@xxxxxxxxx>
Date: Fri, Dec 1, 2023 at 2:57 PM
Subject: Re: [tip:x86/percpu 12/12]
arch/x86/include/asm/preempt.h:27:55: sparse: sparse: incompatible
types for operation (&):
To: kernel test robot <lkp@xxxxxxxxx>
Cc: <oe-kbuild-all@xxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>,
<x86@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Nadav Amit
<namit@xxxxxxxxxx>


On Sun, Oct 8, 2023 at 2:43 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/percpu
> head:   ca4256348660cb2162668ec3d13d1f921d05374a
> commit: ca4256348660cb2162668ec3d13d1f921d05374a [12/12] x86/percpu: Use C for percpu read/write accessors
> config: x86_64-randconfig-122-20231007 (https://download.01.org/0day-ci/archive/20231008/202310080853.UhMe5iWa-lkp@xxxxxxxxx/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231008/202310080853.UhMe5iWa-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202310080853.UhMe5iWa-lkp@xxxxxxxxx/
>
> sparse warnings: (new ones prefixed by >>)
>    kernel/bpf/percpu_freelist.c: note: in included file (through arch/x86/include/asm/preempt.h, include/linux/preempt.h, include/linux/spinlock.h, ...):
>    arch/x86/include/asm/percpu.h:550:49: sparse: sparse: Expected ) at end of cast operator
>    arch/x86/include/asm/percpu.h:550:49: sparse: sparse: got __seg_gs
>    arch/x86/include/asm/percpu.h:564:33: sparse: sparse: Expected ) at end of cast operator
>    arch/x86/include/asm/percpu.h:564:33: sparse: sparse: got __seg_gs

sparse is too strict here. The following code is perfectly legal:

--cut here--
int __seg_gs foo;

int bar (int *pcp)
{
  return *(typeof (*pcp) __seg_gs *)(unsigned long)(pcp);
}
--cut here--

$ gcc -O2 -S -Wextra -Wall test.c
$
$ sparse test.c
test.c:1:14: error: Expected ; at end of declaration
test.c:1:14: error: got foo
test.c:5:26: error: Expected ) at end of cast operator
test.c:5:26: error: got __seg_gs
$

Uros.





[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux