diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-12-05 16:49:55 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-12-07 17:44:50 +0100 |
| commit | 1a17b93361a9c96bccc726b816832432d374967e (patch) | |
| tree | a9ece542d700538d69ef4bccc29991ad9a1c2377 /validation | |
| parent | 913471cdaccb49e735011818e1faea2141f0175b (diff) | |
| download | sparse-dev-1a17b93361a9c96bccc726b816832432d374967e.tar.gz | |
add testcases linearization of degenerated arrays/functions
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/linear/degen-array.c | 31 | ||||
| -rw-r--r-- | validation/linear/degen-function.c | 38 | ||||
| -rw-r--r-- | validation/linear/degen-log-not.c | 41 |
3 files changed, 110 insertions, 0 deletions
diff --git a/validation/linear/degen-array.c b/validation/linear/degen-array.c new file mode 100644 index 00000000..b8a6f4f6 --- /dev/null +++ b/validation/linear/degen-array.c @@ -0,0 +1,31 @@ +extern int a[3]; + +int (*fa(int i))[] { return &a; } +int *f0(int i) { return &a[0]; } +int *fd(int i) { return a; } + +/* + * check-name: degen-array + * check-command: test-linearize -m64 -Wno-decl $file + * + * check-output-start +fa: +.L0: + <entry-point> + ret.64 a + + +f0: +.L2: + <entry-point> + ret.64 a + + +fd: +.L4: + <entry-point> + ret.64 a + + + * check-output-end + */ diff --git a/validation/linear/degen-function.c b/validation/linear/degen-function.c new file mode 100644 index 00000000..6dd3123b --- /dev/null +++ b/validation/linear/degen-function.c @@ -0,0 +1,38 @@ +extern int fun(int); + +typedef int (*fun_t)(int); + +fun_t fa(void) { return &fun; } +fun_t f0(void) { return fun; } + +/* + * check-name: degen-function + * check-command: test-linearize -m64 -Wno-decl -fdump-ir=linearize $file + * + * check-output-start +fa: +.L0: + <entry-point> + symaddr.64 %r1 <- fun + phisrc.64 %phi1(return) <- %r1 + br .L1 + +.L1: + phi.64 %r2 <- %phi1(return) + ret.64 %r1 + + +f0: +.L2: + <entry-point> + symaddr.64 %r3 <- fun + phisrc.64 %phi2(return) <- %r3 + br .L3 + +.L3: + phi.64 %r4 <- %phi2(return) + ret.64 %r3 + + + * check-output-end + */ diff --git a/validation/linear/degen-log-not.c b/validation/linear/degen-log-not.c new file mode 100644 index 00000000..baa7d536 --- /dev/null +++ b/validation/linear/degen-log-not.c @@ -0,0 +1,41 @@ +extern int arr[]; +int test_arr_addr(int i) +{ + if (!&arr) return 1; + return 0; +} + +int test_arr_addr0(int i) +{ + if (!&arr[0]) return 1; + return 0; +} + +int test_arr_degen(int i) +{ + if (!arr) return 1; + return 0; +} + +extern int fun(void); +int test_fun_addr(int i) +{ + if (!&fun) return 1; + return 0; +} + +int test_fun_degen(int i) +{ + if (!fun) return 1; + return 0; +} + +/* + * check-name: degenerate logical-not + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: load + * check-output-excludes: VOID + */ |
