diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-14 08:42:43 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-21 14:34:55 +0100 |
commit | d02b992124038a142416ef1b07011b726a55d772 (patch) | |
tree | fdd6e7f08486b525d372b8fe020c4b67d958eba1 | |
parent | af3512a6c585c68ba8ef2e19d4e4d8a9830679df (diff) | |
download | sparse-d02b992124038a142416ef1b07011b726a55d772.tar.gz |
add testcases for COMPUTEDGOTO simplification
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/optim/cgoto01.c | 25 | ||||
-rw-r--r-- | validation/optim/cgoto02.c | 18 | ||||
-rw-r--r-- | validation/optim/cse-label.c | 14 |
3 files changed, 57 insertions, 0 deletions
diff --git a/validation/optim/cgoto01.c b/validation/optim/cgoto01.c new file mode 100644 index 00000000..350c6cd9 --- /dev/null +++ b/validation/optim/cgoto01.c @@ -0,0 +1,25 @@ +void abort(void) __attribute__((__noreturn__)); + +int foo(int a) +{ + void *label; + + if (a == a) + label = &&L1; + else + label = &&L2; + goto *label; +L1: return 0; +L2: abort(); +} + +/* + * check-name: cgoto01 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: set\\. + * check-output-excludes: jmp + * check-output-excludes: call + */ diff --git a/validation/optim/cgoto02.c b/validation/optim/cgoto02.c new file mode 100644 index 00000000..5869d5b4 --- /dev/null +++ b/validation/optim/cgoto02.c @@ -0,0 +1,18 @@ +int foo(int a) +{ + void *label = a ? &&l1 : &&l2; + goto *label; +l1: + return a; +l2: + return 0; +} + +/* + * check-name: cgoto02 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: %arg1 + */ diff --git a/validation/optim/cse-label.c b/validation/optim/cse-label.c new file mode 100644 index 00000000..e4296820 --- /dev/null +++ b/validation/optim/cse-label.c @@ -0,0 +1,14 @@ +int foo(void) +{ +label: + return &&label == &&label; +} + +/* + * check-name: cse-label + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ |