Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dibyendu Majumdar <mobile@majumdar.org.uk>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: sparse-llvm functions must be cast to correct type before calling
Date: Sun, 19 Mar 2017 01:20:14 +0100	[thread overview]
Message-ID: <20170319002014.p2yah76w6ww35crr@macbook.local> (raw)
In-Reply-To: <CACXZuxcmizMoxj=xGAJYbbEbCHQC=4E7spC4MUqT1=0d+-NiAw@mail.gmail.com>

On Thu, Mar 16, 2017 at 08:58:25PM +0000, Dibyendu Majumdar wrote:
> Hi,
> 
> The following test (adapted from snippet posted by Linus) fails in sparse-llvm:

...
 
> To resolve this before calling a function we need to cast it to the
> expected type. This can be done like this in output_op_call():

This is a very general problem with sparse-llvm, directly caused
by the fact the sparse associates type to instructions and LLVM
to the values.

What's happening is that the first time a pseudo is used
it's a value is created (with the curret type, of course)
*and* is stored in the pseudo::priv.
The next times this pseudo is used the LLVM value is directly
taken from the ::priv without regards for the current type.

In the coming update of the LLVM serie, I added an helper
for this sort of things: adjust_type(). But it need to be
added at the right place(s).

-- Luc

      reply	other threads:[~2017-03-19  0:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 20:58 sparse-llvm functions must be cast to correct type before calling Dibyendu Majumdar
2017-03-19  0:20 ` Luc Van Oostenryck [this message]

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=20170319002014.p2yah76w6ww35crr@macbook.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    /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