linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Roman Kagan <rkagan@virtuozzo.com>,
	"Denis V. Lunev" <den@openvz.org>,
	Andrey Smetanin <asmetanin@virtuozzo.com>,
	Linux-Sparse <linux-sparse@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH] Do not drop 'nocast' modifier when taking the address.
Date: Wed, 3 Feb 2016 12:09:16 +0800	[thread overview]
Message-ID: <CANeU7Qmch59PjG6FTk9kYoQ0Lg97pvP_SM+Nvccn+JPBW1Vunw@mail.gmail.com> (raw)
In-Reply-To: <20160203034357.GA3332@macbook.lan>

On Wed, Feb 3, 2016 at 11:43 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
pped.
>
> The nocast mod is dropped and lost in the function create_pointer().
> In the example above, "cputime_t *" has type :
>         unsigned long [nocast] [usertype] *
> while &utime is just:
>         unsigned long *

That is my point. Why does "&utime" get drop but "cputime_t *" does not?
They both are pointer of a base type. They both create pointers.

It seems to me the bug is sparse not treating this two case consistently.

> So, for sparse and its extended notion of type, the type we get when
> taking the address of a [variable of some] type X is not the same as
> directly using a pointer to the type X.

In C language type system,  these two should be the same type. It is a
bug in sparse if they are not. I would rather get that bug fixed.

> Which is very fine, just that MOD_NOCAST is dropped while the example
> shows that it should not.

I think that is a separate issue weather MOD_NOCAST should be inherent
from pointer base type. Same with MOD_STORAGE.

Chris

  reply	other threads:[~2016-02-03  4:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201509182109.6ccgXDVp%fengguang.wu@intel.com>
     [not found] ` <55FC16F4.7060407@openvz.org>
     [not found]   ` <55FC17B4.9060702@redhat.com>
     [not found]     ` <20150918144026.GJ3317@rkaganb.sw.ru>
     [not found]       ` <55FC22B4.9010301@redhat.com>
2015-09-18 15:06         ` [kbuild-all] [kvm:queue 27/38] arch/x86/kvm/hyperv.c:186:41: sparse: incorrect type in argument 2 (different modifiers) Fengguang Wu
2016-01-05 13:51           ` Luc Van Oostenryck
2016-01-05 16:25             ` [PATCH] Do not drop 'nocast' modifier when taking the address Luc Van Oostenryck
2016-02-02 20:25               ` Christopher Li
2016-02-03  3:43                 ` Luc Van Oostenryck
2016-02-03  4:09                   ` Christopher Li [this message]
2016-02-03  9:15                     ` Luc Van Oostenryck
2016-02-22 18:41                       ` 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=CANeU7Qmch59PjG6FTk9kYoQ0Lg97pvP_SM+Nvccn+JPBW1Vunw@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=asmetanin@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=rkagan@virtuozzo.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=torvalds@linux-foundation.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).