diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-08 21:31:28 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-17 10:04:37 +0100 |
| commit | 17f4ee591da59e5399319f0c0a5444200f9ae99d (patch) | |
| tree | fea309e44c141ee871f5b58e4432cbd48fb111c5 /validation/backend/degenerate-ptr.c | |
| parent | 4bdb815f9d1557c7377fd22194f194e9eba9b142 (diff) | |
| download | sparse-dev-17f4ee591da59e5399319f0c0a5444200f9ae99d.tar.gz | |
llvm: add test cases for degenerated pointers
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/backend/degenerate-ptr.c')
| -rw-r--r-- | validation/backend/degenerate-ptr.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/validation/backend/degenerate-ptr.c b/validation/backend/degenerate-ptr.c new file mode 100644 index 00000000..5e71d0d8 --- /dev/null +++ b/validation/backend/degenerate-ptr.c @@ -0,0 +1,73 @@ +extern int array[3]; +extern int matrix[3][3]; +extern int fun(int); + +extern int fia(int []); +extern int fip(int *); +extern int fim(int (*)[3]); +extern int fvp(void *); +extern int ffp(int (*)(int)); + +void call(void); +void call(void) +{ + fia(array); + + fip(array); + fim(matrix); + + fvp(array); + fvp(matrix); + + fvp(fun); + fvp(&fun); + ffp(fun); + ffp(&fun); +} + +void local(void); +void local(void) +{ + int *ip; + int (*im)[3]; + void *vp; + int (*fp)(int); + + ip = array; + im = matrix; + + vp = array; + vp = matrix; + + vp = fun; + vp = &fun; + fp = fun; + fp = &fun; +} + + +extern int *ip; +extern int (*im)[3]; +extern void *vp; +extern int (*fp)(int); + +void global(void); +void global(void) +{ + ip = array; + im = matrix; + + vp = array; + vp = matrix; + + vp = fun; + vp = &fun; + fp = fun; + fp = &fun; +} + +/* + * check-name: degenerated pointer handling + * check-command: ./sparsec -c $file -o tmp.o + * check-known-to-fail + */ |
