linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse error on __int128
@ 2015-08-11 11:32 Tony Camuso
  2016-01-05  0:08 ` Luc Van Oostenryck
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Camuso @ 2015-08-11 11:32 UTC (permalink / raw)
  To: Linux-Sparse; +Cc: Christopher Li

I think I've raised this question before, but I don't think I
got a response that indicated whether this is a sparse bug or
if there was a source or compile issue.

Here is the error:
sparse /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i
/work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: impossible combination of type specifiers: unsigned __int128
/work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: Expected ) at end of cast operator
/work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: got __int128

Here is the offending line in context:

  5503 static inline __attribute__((no_instrument_function)) u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
  5504 {
  5505  return (u64)(((unsigned __int128)a * mul) >> shift);
  5506 }

Here is the compile command:

$ gcc -E -Wp,-MD,/work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/.fw_common.i.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/5.1.1/include -I/work/rh7/arch/x86/include -Iarch/x86/include/generated  -Iinclude -I/work/rh7/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/work/rh7/include/uapi -Iinclude/generated/uapi -include /work/rh7/include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mno-sse -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -Wframe-larger-than=2048 -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=
 1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=2048!
  -fstack-p
rotector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D__CHECK_ENDIAN__  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(fw_common)"  -D"KBUILD_MODNAME=KBUILD_STR(rtl8723_common)" -o /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse error on __int128
  2015-08-11 11:32 sparse error on __int128 Tony Camuso
@ 2016-01-05  0:08 ` Luc Van Oostenryck
  2016-01-13 14:06   ` Tony Camuso
  0 siblings, 1 reply; 5+ messages in thread
From: Luc Van Oostenryck @ 2016-01-05  0:08 UTC (permalink / raw)
  To: Tony Camuso; +Cc: Linux-Sparse, Christopher Li

On Tue, Aug 11, 2015 at 07:32:31AM -0400, Tony Camuso wrote:
> I think I've raised this question before, but I don't think I
> got a response that indicated whether this is a sparse bug or
> if there was a source or compile issue.
> 
> Here is the error:
> sparse /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i
> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: impossible combination of type specifiers: unsigned __int128
> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: Expected ) at end of cast operator
> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: got __int128
> 
> Here is the offending line in context:
> 
>  5503 static inline __attribute__((no_instrument_function)) u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
>  5504 {
>  5505  return (u64)(((unsigned __int128)a * mul) >> shift);
>  5506 }
> 


Hi,

There is no source or compile issue here.
It's just that __int128 is only defined by gcc on x86_64
but is not defined by sparse.

Now, __int128 is only used twice in the kernel:
(mul_u64_u32_shr() & mul_u64_u64_shr()) and then only if
supported by the platform and if __SIZEOF_INT128__ is defined.
Since sparse doesn't define __SIZEOF_INT128__ there shouldn't be any problems
but you have used sparse not on the code itself but on preprocessed code by gcc.
If you run sparse directly on the C code or more simply by using "make C=1 ..."
to build kernel code, no such problem occurs.

Now, of course, one could argue that sparse should also define __int128
on platforms where gcc define it, on x86_64 thus.


Regards,
Luc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse error on __int128
  2016-01-05  0:08 ` Luc Van Oostenryck
@ 2016-01-13 14:06   ` Tony Camuso
  2016-01-25 17:47     ` Luc Van Oostenryck
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Camuso @ 2016-01-13 14:06 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse, Christopher Li

On 01/04/2016 07:08 PM, Luc Van Oostenryck wrote:
> On Tue, Aug 11, 2015 at 07:32:31AM -0400, Tony Camuso wrote:
>> I think I've raised this question before, but I don't think I
>> got a response that indicated whether this is a sparse bug or
>> if there was a source or compile issue.
>>
>> Here is the error:
>> sparse /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i
>> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: impossible combination of type specifiers: unsigned __int128
>> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: Expected ) at end of cast operator
>> /work/rh7/drivers/net/wireless/rtlwifi/rtl8723com/fw_common.i:5505:26: error: got __int128
>>
>> Here is the offending line in context:
>>
>>   5503 static inline __attribute__((no_instrument_function)) u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
>>   5504 {
>>   5505  return (u64)(((unsigned __int128)a * mul) >> shift);
>>   5506 }
>>
>
>
> Hi,
>
> There is no source or compile issue here.
> It's just that __int128 is only defined by gcc on x86_64
> but is not defined by sparse.
>
> Now, __int128 is only used twice in the kernel:
> (mul_u64_u32_shr() & mul_u64_u64_shr()) and then only if
> supported by the platform and if __SIZEOF_INT128__ is defined.
> Since sparse doesn't define __SIZEOF_INT128__ there shouldn't be any problems
> but you have used sparse not on the code itself but on preprocessed code by gcc.
> If you run sparse directly on the C code or more simply by using "make C=1 ..."
> to build kernel code, no such problem occurs.
>
> Now, of course, one could argue that sparse should also define __int128
> on platforms where gcc define it, on x86_64 thus.

Hi, Luc.

Thank you for responding. We are using preprocessor files, because what we're
trying to do is to use sparse to identify exported symbols and all their
dependencies, so we need to pull in the .h files, which the preprocessor does
for us.

So, I will apply the argument you so graciously supplied and posit that sparse
should define __int128 on platforms where gcc defines it, e.g. x86_64. :)

It doesn't seem like a very intrusive change.

>
> Regards,
> Luc
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse error on __int128
  2016-01-13 14:06   ` Tony Camuso
@ 2016-01-25 17:47     ` Luc Van Oostenryck
  2016-01-25 18:42       ` Tony Camuso
  0 siblings, 1 reply; 5+ messages in thread
From: Luc Van Oostenryck @ 2016-01-25 17:47 UTC (permalink / raw)
  To: Tony Camuso; +Cc: Linux-Sparse, Christopher Li

On Wed, Jan 13, 2016 at 09:06:33AM -0500, Tony Camuso wrote:
...

> >Now, of course, one could argue that sparse should also define __int128
> >on platforms where gcc define it, on x86_64 thus.

...

> So, I will apply the argument you so graciously supplied and posit that sparse
> should define __int128 on platforms where gcc defines it, e.g. x86_64. :)
> 
> It doesn't seem like a very intrusive change.


Hehe :)
Feel like writing a patch for it?

Luc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sparse error on __int128
  2016-01-25 17:47     ` Luc Van Oostenryck
@ 2016-01-25 18:42       ` Tony Camuso
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Camuso @ 2016-01-25 18:42 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Linux-Sparse, Christopher Li

On 01/25/2016 12:47 PM, Luc Van Oostenryck wrote:
> On Wed, Jan 13, 2016 at 09:06:33AM -0500, Tony Camuso wrote:
> ...
>
>>> Now, of course, one could argue that sparse should also define __int128
>>> on platforms where gcc define it, on x86_64 thus.
>
> ...
>
>> So, I will apply the argument you so graciously supplied and posit that sparse
>> should define __int128 on platforms where gcc defines it, e.g. x86_64. :)
>>
>> It doesn't seem like a very intrusive change.
>
>
> Hehe :)
> Feel like writing a patch for it?
>
> Luc
>

Sure! ;)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-25 18:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11 11:32 sparse error on __int128 Tony Camuso
2016-01-05  0:08 ` Luc Van Oostenryck
2016-01-13 14:06   ` Tony Camuso
2016-01-25 17:47     ` Luc Van Oostenryck
2016-01-25 18:42       ` Tony Camuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).