diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-02 22:30:40 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-03-24 22:14:17 +0100 |
commit | 92169b2aecd4794b7eee21f869228967245c87e2 (patch) | |
tree | 0b75d5b1d1f135db621f20b462564a958ddca0c9 | |
parent | d549d4d55eecb394e3f69314287f91e85b19e3e3 (diff) | |
download | sparse-92169b2aecd4794b7eee21f869228967245c87e2.tar.gz |
add testcases for stores simplifications
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/memops/kill-dead-store-parent0.c | 15 | ||||
-rw-r--r-- | validation/memops/kill-dead-store-parent2.c | 26 | ||||
-rw-r--r-- | validation/memops/kill-redundant-store0.c | 14 |
3 files changed, 55 insertions, 0 deletions
diff --git a/validation/memops/kill-dead-store-parent0.c b/validation/memops/kill-dead-store-parent0.c new file mode 100644 index 00000000..1413134b --- /dev/null +++ b/validation/memops/kill-dead-store-parent0.c @@ -0,0 +1,15 @@ +void foo(int *ptr, int p) +{ + if (p) + *ptr = 1; + *ptr = 0; +} + +/* + * check-name: kill-dead-store-parent0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-pattern(1): store + */ diff --git a/validation/memops/kill-dead-store-parent2.c b/validation/memops/kill-dead-store-parent2.c new file mode 100644 index 00000000..b563fd31 --- /dev/null +++ b/validation/memops/kill-dead-store-parent2.c @@ -0,0 +1,26 @@ +int ladder02(int *ptr, int p, int x) +{ + *ptr = x++; + if (p) + goto l11; + else + goto l12; +l11: + *ptr = x++; + goto l20; +l12: + *ptr = x++; + goto l20; +l20: + *ptr = x++; + return *ptr; +} + +/* + * check-name: kill-dead-store-parent2 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-pattern(1): store + */ diff --git a/validation/memops/kill-redundant-store0.c b/validation/memops/kill-redundant-store0.c new file mode 100644 index 00000000..e911166d --- /dev/null +++ b/validation/memops/kill-redundant-store0.c @@ -0,0 +1,14 @@ +void foo(int *ptr) +{ + int i = *ptr; + *ptr = i; +} + +/* + * check-name: kill-redundant-store0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: store + */ |