From bb213492a306d68c1254382c254261232981e148 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Tue, 2 Jun 2020 18:13:01 +0200 Subject: testsuite: plain chars are never compatible with [un]signed chars 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 --- 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 00000000..cdfe1a31 --- /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 + */ -- cgit 1.2.3-korg