aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/memops
diff options
Diffstat (limited to 'validation/memops')
-rw-r--r--validation/memops/type-punning-flt2int.c20
-rw-r--r--validation/memops/type-punning-int2flt.c20
2 files changed, 40 insertions, 0 deletions
diff --git a/validation/memops/type-punning-flt2int.c b/validation/memops/type-punning-flt2int.c
new file mode 100644
index 00000000..a76c6c1d
--- /dev/null
+++ b/validation/memops/type-punning-flt2int.c
@@ -0,0 +1,20 @@
+union u {
+ int i;
+ float f;
+};
+
+static int foo(void)
+{
+ union u u = { .f = 0.123 };
+ return u.i;
+}
+
+/*
+ * check-name: type-punning-float-to-int
+ * check description: must not infer the int value from the float
+ * check-command: test-linearize $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: load\\.
+ */
diff --git a/validation/memops/type-punning-int2flt.c b/validation/memops/type-punning-int2flt.c
new file mode 100644
index 00000000..c05ce252
--- /dev/null
+++ b/validation/memops/type-punning-int2flt.c
@@ -0,0 +1,20 @@
+union u {
+ int i;
+ float f;
+};
+
+static float foo(void)
+{
+ union u u = { .i = 3 };
+ return u.f;
+}
+
+/*
+ * check-name: type-punning-int-to-float
+ * check description: must not infer the float value from the int
+ * check-command: test-linearize $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: load\\.
+ */