new file mode 100644
@@ -0,0 +1,20 @@
+#define __as __attribute__((address_space(1)))
+
+static void test_as(void)
+{
+ int __as obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr; /* check-should-pass */
+ typeof(obj) *ptr4 = ptr; /* check-should-pass */
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+/*
+ * check-name: typeof-addresspace.c
+ * check-known-to-fail
+ */
new file mode 100644
@@ -0,0 +1,109 @@
+#define __noderef __attribute__((noderef))
+#define __bitwise __attribute__((bitwise))
+#define __nocast __attribute__((nocast))
+#define __safe __attribute__((safe))
+
+static void test_spec(void)
+{
+ unsigned int obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+static void test_const(void)
+{
+ const int obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ ptr = ptr;
+ ptr = &obj;
+}
+
+static void test_volatile(void)
+{
+ volatile int obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+static void test_bitwise(void)
+{
+ typedef int __bitwise type_t;
+ type_t obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+static void test_static(void)
+{
+ static int obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+static void test_tls(void)
+{
+ __thread int obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+static void test_nocast(void)
+{
+ int __nocast obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+/*
+ * check-name: typeof-mods
+ * check-known-to-fail
+ *
+ * check-error-start
+ * check-error-end
+ */
new file mode 100644
@@ -0,0 +1,19 @@
+#define __noderef __attribute__((noderef))
+
+static void test_noderef(void)
+{
+ int __noderef obj, *ptr;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ ptr = ptr;
+ ptr = &obj;
+}
+
+/*
+ * check-name: typeof-noderef
+ * check-known-to-fail
+ *
+ * check-error-start
+ * check-error-end
+ */
new file mode 100644
@@ -0,0 +1,23 @@
+#define __safe __attribute__((safe))
+
+static void test_safe(void)
+{
+ int __safe obj, *ptr;
+ typeof(obj) var = obj;
+ typeof(ptr) ptr2 = ptr;
+ typeof(*ptr) var2 = obj;
+ typeof(*ptr) *ptr3 = ptr;
+ typeof(obj) *ptr4 = ptr;
+ obj = obj;
+ ptr = ptr;
+ ptr = &obj;
+ obj = *ptr;
+}
+
+/*
+ * check-name: typeof-safe
+ * check-known-to-fail
+ *
+ * check-error-start
+ * check-error-end
+ */
Note: address space, 'safe' & 'noderef' have their own test file because they have others issues or need to be handled differently. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/typeof-addresspace.c | 20 ++++++++ validation/typeof-mods.c | 109 ++++++++++++++++++++++++++++++++++++++++ validation/typeof-noderef.c | 19 +++++++ validation/typeof-safe.c | 23 +++++++++ 4 files changed, 171 insertions(+) create mode 100644 validation/typeof-addresspace.c create mode 100644 validation/typeof-mods.c create mode 100644 validation/typeof-noderef.c create mode 100644 validation/typeof-safe.c