diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-23 17:12:56 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-11-01 01:04:16 +0100 |
commit | 594c7389969f79919f1170693c970fb25b8bfe4d (patch) | |
tree | 598414cce894aade7d0da5f6863910b4f75a7346 | |
parent | dc27965726cbc506250ccc12c5169be048a01082 (diff) | |
download | sparse-594c7389969f79919f1170693c970fb25b8bfe4d.tar.gz |
eval_insn: add testcases for incorrect type in OP_SET_*
Because of the lack of type information, compare instruction are
not always handled correctly. So, add some testcases for this.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/optim/cmp-op-type.c | 18 | ||||
-rw-r--r-- | validation/optim/cmp-type0.c | 13 | ||||
-rw-r--r-- | validation/optim/cmp-type1.c | 16 |
3 files changed, 47 insertions, 0 deletions
diff --git a/validation/optim/cmp-op-type.c b/validation/optim/cmp-op-type.c new file mode 100644 index 00000000..037272f8 --- /dev/null +++ b/validation/optim/cmp-op-type.c @@ -0,0 +1,18 @@ +extern int get(void); + +static int array[8192]; + +static int foo(void) +{ + int n = -1; + if (n < 0) + n = get(); + return array[n]; +} + +/* + * check-name: cmp-op-type + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + */ diff --git a/validation/optim/cmp-type0.c b/validation/optim/cmp-type0.c new file mode 100644 index 00000000..ab9d53d4 --- /dev/null +++ b/validation/optim/cmp-type0.c @@ -0,0 +1,13 @@ +static int foo(long long a) +{ + return 0LL < (0x80000000LL + (a - a)); +} + +/* + * check-name: cmp-type0 + * check-command: test-linearize $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ diff --git a/validation/optim/cmp-type1.c b/validation/optim/cmp-type1.c new file mode 100644 index 00000000..ee0bd75a --- /dev/null +++ b/validation/optim/cmp-type1.c @@ -0,0 +1,16 @@ +int foo(void) +{ + int r; + long n; + n = 0; + return n < 2147483648U; +} + +/* + * check-name: cmp-type1 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-returns: 1 + */ |