aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear/bool-cast.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-12-11 13:33:13 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-23 07:46:39 +0200
commit86af2a17d26712bce69759120c290c5ede88f677 (patch)
treec29b24b7dde23233b88a99fe3fc29538bd18bb5d /validation/linear/bool-cast.c
parent3e7e84decfebec22936e288e66fd7a5a51f01fc7 (diff)
downloadsparse-dev-86af2a17d26712bce69759120c290c5ede88f677.tar.gz
cast: reorg testcases related to casts
* merge the tests about implicit & explicit casts in a single file as there was a lot of redundancy. * shuffle the tests to linear/ or optim/ Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear/bool-cast.c')
-rw-r--r--validation/linear/bool-cast.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/validation/linear/bool-cast.c b/validation/linear/bool-cast.c
new file mode 100644
index 00000000..981e9f83
--- /dev/null
+++ b/validation/linear/bool-cast.c
@@ -0,0 +1,32 @@
+extern int fun(void);
+typedef unsigned int u32;
+typedef int s32;
+typedef void *vdp;
+typedef int *sip;
+typedef double dbl;
+typedef unsigned short __attribute__((bitwise)) le16;
+
+static _Bool fs32_i(s32 a) { return a; }
+static _Bool fs32_e(s32 a) { return (_Bool)a; }
+static _Bool fu32_i(u32 a) { return a; }
+static _Bool fu32_e(u32 a) { return (_Bool)a; }
+static _Bool fvdp_i(vdp a) { return a; }
+static _Bool fvdp_e(vdp a) { return (_Bool)a; }
+static _Bool fsip_i(sip a) { return a; }
+static _Bool fsip_e(sip a) { return (_Bool)a; }
+static _Bool ffun_i(void) { return fun; }
+static _Bool ffun_e(void) { return (_Bool)fun; }
+static _Bool fres_i(le16 a) { return a; }
+static _Bool fres_e(le16 a) { return (_Bool)a; }
+static _Bool fdbl_i(dbl a) { return a; }
+static _Bool fdbl_e(dbl a) { return (_Bool)a; }
+
+/*
+ * check-name: bool-cast
+ * check-command: test-linearize -m64 -fdump-ir=linearize $file
+ *
+ * check-output-ignore
+ * check-output-excludes: cast\\.
+ * check-output-pattern(12): setne\\.
+ * check-output-pattern(2): fcmpune\\.
+ */