diff options
| author | Linus Torvalds <torvalds@home.osdl.org> | 2003-08-02 00:42:32 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:00:58 -0700 |
| commit | 867a48ac4b54a02da15c6a1e125d4b75b72506a3 (patch) | |
| tree | a33d68b8b4773fd0afce10e6a6f9efdad4f5026d /validation | |
| parent | 6e3bed4e8a22c98fa2033fe7b6bbca29986c7be4 (diff) | |
| download | sparse-dev-867a48ac4b54a02da15c6a1e125d4b75b72506a3.tar.gz | |
Add a type checking validation test-case that shows some of
the current brokenness in type generation and checking.
Run
./check validation/type1.c
to see these totally bogus error messages:
warning: validation/type1.c:23:15: incorrect type in initializer (different base types)
warning: validation/type1.c:23:15: expected char const *s
warning: validation/type1.c:23:15: got struct hello *arg
This bug causes several bogus warnings in the kernel.
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/type1.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/validation/type1.c b/validation/type1.c new file mode 100644 index 00000000..6b19dc9b --- /dev/null +++ b/validation/type1.c @@ -0,0 +1,24 @@ +/* + * We get this wrong for some strange reason. + * + * When evaluating the argument to the inline + * function for the array, we don't properly + * demote the "char []" to a "char *", but instead + * we follow the dereference and get a "struct hello". + * + * Which makes no sense at all. + */ + +static inline int deref(const char *s) +{ + return *s; +} + +struct hello { + char array[10]; +}; + +int test(struct hello *arg) +{ + return deref(arg->array); +} |
