diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2016-11-24 18:09:42 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-02-13 09:34:44 +0800 |
| commit | 66140b83fec0b43643b15b6b6be79d33839eb21f (patch) | |
| tree | 545bd6899cca2b5ab7eaee9d0f3a2844f3214aff /validation | |
| parent | 6e3d2b3f92b68e14c88bbc1ff73723790e46df44 (diff) | |
| download | sparse-dev-66140b83fec0b43643b15b6b6be79d33839eb21f.tar.gz | |
storage should not be inherited by pointers
Information about storage is needed for objects but once
you take the address of an object, its storage should be
irrelevant for the resulting pointer.
Trying to keep the storage into the pointer's modifiers
(while it will be available in the base type anyway) only
create corner cases later.
An example of the problem it can create is when the pointer
is dereferenced in an inlined function.
Better to simply not put have the storage informations
for the pointer, which is what this patch does.
To better illustrate the situation, suppose you have the
following variable declaration:
static int var;
var's type should be:
int static [toplevel] [addressable]
if you take its address the resulting pointer will be of type:
int static [toplevel] *
while it should simply be:
int *
Detected-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/nocast.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/validation/nocast.c b/validation/nocast.c index c28676a3..cc0ab6b7 100644 --- a/validation/nocast.c +++ b/validation/nocast.c @@ -160,7 +160,7 @@ nocast.c:34:33: got unsigned long nocast.c:34:33: warning: implicit cast to nocast type nocast.c:35:39: warning: incorrect type in initializer (different modifiers) nocast.c:35:39: expected unsigned long *static [toplevel] bad_ptr_from -nocast.c:35:39: got unsigned long static [nocast] [toplevel] *<noident> +nocast.c:35:39: got unsigned long [nocast] *<noident> nocast.c:35:39: warning: implicit cast from nocast type nocast.c:50:16: warning: implicit cast from nocast type nocast.c:54:16: warning: implicit cast from nocast type |
