linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>,
	Dibyendu Majumdar <mobile@majumdar.org.uk>
Subject: Re: [PATCH] fix expansion of constant bitfield dereference
Date: Mon, 21 Aug 2017 15:42:28 +0200	[thread overview]
Message-ID: <CAMHZB6HJWjTycs9xm_j4WU+aF1W9mb4+9wTTNid-OdZDkUEigw@mail.gmail.com> (raw)
In-Reply-To: <CANeU7Q=HgV-H0yRZ60n1A0uo79z+0F6mQEVxN8PQhQ_RQnB2NQ@mail.gmail.com>

On Mon, Aug 21, 2017 at 2:26 PM, Christopher Li <sparse@chrisli.org> wrote:
> On Sun, Aug 20, 2017 at 6:16 PM, Luc Van Oostenryck wrote:
>
> With this applied, sparse still have a bug at did not match the
> value to the bit field member, right? I saw on the other email
> thread said the value always pick offset zero.

I'm not sure to understand.
Have you an example?

> Should I apply this as patch format or wait for it show up in a
> git pull request later?

Wait for the pull request, please.

>> --- a/expand.c
>> +++ b/expand.c
>> @@ -644,6 +644,8 @@ static int expand_dereference(struct expression *expr)
>>                 if (value) {
>>                         /* FIXME! We should check that the size is right! */
>>                         if (value->type == EXPR_VALUE) {
>> +                               if (is_bitfield_type(value->ctype))
>> +                                       return UNSAFE;
>
> You might want to consider move this outside of the EXPR_VALUE.
> I assume there is a bug in sparse matching the value to the member
> wrong, it could happen to EXPR_FVALUE as well.

Well ..., if we have an EXPR_FVALUE which type is a bitfield, yes
for sure there would be a bug. But I have no reason to belive there
is such bug and since checking the ctype is more costly than checking
the expr->type, I think it's best so.

Note, I find this check already annoying and hackish if not worse.

-- Luc

  parent reply	other threads:[~2017-08-21 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20 22:16 [PATCH] fix expansion of constant bitfield dereference Luc Van Oostenryck
2017-08-20 22:19 ` Dibyendu Majumdar
2017-08-21 12:26 ` Christopher Li
2017-08-21 13:32   ` Dibyendu Majumdar
2017-08-21 13:41     ` Christopher Li
2017-08-21 13:42   ` Luc Van Oostenryck [this message]
2017-08-21 16:06     ` Christopher Li
2017-08-21 16:14       ` Luc Van Oostenryck
2017-08-21 16:46         ` Christopher Li

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=CAMHZB6HJWjTycs9xm_j4WU+aF1W9mb4+9wTTNid-OdZDkUEigw@mail.gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    --cc=sparse@chrisli.org \
    /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).