aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/bitwise-is-signed.c
diff options
context:
space:
mode:
Diffstat (limited to 'validation/bitwise-is-signed.c')
-rw-r--r--validation/bitwise-is-signed.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/validation/bitwise-is-signed.c b/validation/bitwise-is-signed.c
new file mode 100644
index 00000000..dd9c1471
--- /dev/null
+++ b/validation/bitwise-is-signed.c
@@ -0,0 +1,22 @@
+#define __bitwise __attribute__((bitwise))
+
+#define is_signed_type(type) (((type)-1) <= 0)
+
+typedef signed int __bitwise s;
+typedef unsigned int __bitwise u;
+
+int fos(void);
+int fou(void);
+
+
+int fos(void) { return is_signed_type(s); }
+int fou(void) { return !is_signed_type(u); }
+
+/*
+ * check-name: bitwise-is-signed
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */