[PATCH 01/17] split testcases for type punning & constant initializer expansion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Several issues were covered by the same testcase.

Fix this by splitting the testcases.
Also, rename these testcases to a more descriptive name.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/expand/constant-union-flt2int.c    | 21 +++++++++++++++++++
 validation/expand/constant-union-int2flt.c    | 20 ++++++++++++++++++
 .../constant-union-size.c}                    |  6 +++---
 .../type-punning-flt2int.c}                   |  4 ++--
 validation/memops/type-punning-int2flt.c      | 20 ++++++++++++++++++
 5 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 validation/expand/constant-union-flt2int.c
 create mode 100644 validation/expand/constant-union-int2flt.c
 rename validation/{bug-expand-union0.c => expand/constant-union-size.c} (60%)
 rename validation/{bug-expand-union1.c => memops/type-punning-flt2int.c} (68%)
 create mode 100644 validation/memops/type-punning-int2flt.c

diff --git a/validation/expand/constant-union-flt2int.c b/validation/expand/constant-union-flt2int.c
new file mode 100644
index 000000000000..1c8f480b6c81
--- /dev/null
+++ b/validation/expand/constant-union-flt2int.c
@@ -0,0 +1,21 @@
+union u {
+	int i;
+	float f;
+};
+
+static int foo(void)
+{
+	union u u = { .f = 0.123 };
+	return u.i;
+}
+
+/*
+ * check-name: constant-union-float-to-int
+ * check description: must not infer the int value from the float
+ * check-command: test-linearize -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(1): setfval\\.
+ * check-output-pattern(1): load\\.
+ */
diff --git a/validation/expand/constant-union-int2flt.c b/validation/expand/constant-union-int2flt.c
new file mode 100644
index 000000000000..ff0a642ad67d
--- /dev/null
+++ b/validation/expand/constant-union-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: constant-union-int-to-float
+ * check description: must not infer the float value from the int
+ * check-command: test-linearize -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(1): load\\.
+ */
diff --git a/validation/bug-expand-union0.c b/validation/expand/constant-union-size.c
similarity index 60%
rename from validation/bug-expand-union0.c
rename to validation/expand/constant-union-size.c
index dd6d60c3e291..b6c3ac75ae4b 100644
--- a/validation/bug-expand-union0.c
+++ b/validation/expand/constant-union-size.c
@@ -10,9 +10,9 @@ static int foo(void)
 }
 
 /*
- * check-name: bug-expand-union
- * check description: must not infer the value from the float
- * check-command: test-linearize $file
+ * check-name: constant-union-size
+ * check description: the size of the initializer doesn't match
+ * check-command: test-linearize -fdump-ir $file
  * check-known-to-fail
  *
  * check-output-ignore
diff --git a/validation/bug-expand-union1.c b/validation/memops/type-punning-flt2int.c
similarity index 68%
rename from validation/bug-expand-union1.c
rename to validation/memops/type-punning-flt2int.c
index 582a1f4f837e..a76c6c1da534 100644
--- a/validation/bug-expand-union1.c
+++ b/validation/memops/type-punning-flt2int.c
@@ -10,8 +10,8 @@ static int foo(void)
 }
 
 /*
- * check-name: bug-expand-union
- * check description: must not infer the value from the float
+ * 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
  *
diff --git a/validation/memops/type-punning-int2flt.c b/validation/memops/type-punning-int2flt.c
new file mode 100644
index 000000000000..c05ce252f305
--- /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\\.
+ */
-- 
2.24.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux