linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Tony Camuso <tcamuso@redhat.com>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>,
	Christopher Li <sparse@chrisli.org>
Subject: Re: sparse error on __int128
Date: Tue, 5 Jan 2016 01:08:02 +0100	[thread overview]
Message-ID: <20160105000800.GA12116@macpro.local> (raw)
In-Reply-To: <55C9DD4F.9050805@redhat.com>

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

  reply	other threads:[~2016-01-05  0:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 11:32 sparse error on __int128 Tony Camuso
2016-01-05  0:08 ` Luc Van Oostenryck [this message]
2016-01-13 14:06   ` Tony Camuso
2016-01-25 17:47     ` Luc Van Oostenryck
2016-01-25 18:42       ` Tony Camuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160105000800.GA12116@macpro.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --cc=tcamuso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).