diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-24 08:49:53 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:01:42 -0700 |
| commit | 7925d5203a63c8f99764b21f9bc05d505ccdd65d (patch) | |
| tree | c14c32c6748f9dcc9861a36bb02d16f84b9d63f3 /validation | |
| parent | 56d6c239e86efc493ffc8e01c55bb54ed10f4fa5 (diff) | |
| download | sparse-dev-7925d5203a63c8f99764b21f9bc05d505ccdd65d.tar.gz | |
Add a few test-cases that Al Viro noted.
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/bitfields.c | 18 | ||||
| -rw-r--r-- | validation/struct-as.c | 16 |
2 files changed, 34 insertions, 0 deletions
diff --git a/validation/bitfields.c b/validation/bitfields.c new file mode 100644 index 00000000..292a110b --- /dev/null +++ b/validation/bitfields.c @@ -0,0 +1,18 @@ +/* + * Al Viro points out that we don't + * do bitfield -> integer promotions + * for array dereferences + * + * "warning: a.c:16:10: incompatible types for operation" + */ +struct { + int x:4; +} y; + +extern int a[]; + +int b(void) +{ + return a[y.x]; +} + diff --git a/validation/struct-as.c b/validation/struct-as.c new file mode 100644 index 00000000..f5752f0c --- /dev/null +++ b/validation/struct-as.c @@ -0,0 +1,16 @@ +/* + * Structure members should get the address + * space of their pointer. + */ +#define __user __attribute__((address_space(1))) + +struct hello { + int a; +}; + +extern int test(int __user *ip); + +int broken(struct hello __user *sp) +{ + test(&sp->a); +} |
