aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/memops/type-punning-flt2int.c
diff options
context:
space:
mode:
Diffstat (limited to 'validation/memops/type-punning-flt2int.c')
-rw-r--r--validation/memops/type-punning-flt2int.c19
1 files changed, 19 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..fadaf687
--- /dev/null
+++ b/validation/memops/type-punning-flt2int.c
@@ -0,0 +1,19 @@
+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-output-ignore
+ * check-output-contains: load\\.
+ */