[PATCH] testsuite: plain chars are never compatible with [un]signed chars

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

 



In standard C, plain chars are either signed or unsigned but are only
compatible with themselves, not with signed chars nor with unsigned ones.

However, Sparse has this wrong and make them compatible with the
corresponding sign-qualified chars.

So, add a testcase for this.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/plain-char-compatibility.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 validation/plain-char-compatibility.c

diff --git a/validation/plain-char-compatibility.c b/validation/plain-char-compatibility.c
new file mode 100644
index 000000000000..cdfe1a31574f
--- /dev/null
+++ b/validation/plain-char-compatibility.c
@@ -0,0 +1,19 @@
+static int sfoo(void)
+{
+	return __builtin_types_compatible_p(char, signed char);
+}
+
+static int ufoo(void)
+{
+	return __builtin_types_compatible_p(char, unsigned char);
+}
+
+/*
+ * check-name: plain-char-compatibility
+ * check-command: test-linearize $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(2): ret.*\\$0
+ * check-output-excludes: ret.*\\$1
+ */
-- 
2.27.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