aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorChristopher Li <sparse@chrisli.org>2008-12-25 14:20:38 -0800
committerChristopher Li <sparse@chrisli.org>2008-12-25 14:20:38 -0800
commiteb8559bf861c94ab7958105efa812b21e1da2d51 (patch)
treee0ec69d08b91a468f7c2838e61e8a7c8d013c162 /validation
parent2479d0f7819bdc4328f28c317248f1a6f78e3e9f (diff)
downloadsparse-dev-eb8559bf861c94ab7958105efa812b21e1da2d51.tar.gz
Teach classify_type to handle typeof
This change will fix Rusty Russel's test case: (*(typeof(v) __attribute__((address_space(0), force)) *)(&v)) Signed-Off-By: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/typeof-attribute.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/validation/typeof-attribute.c b/validation/typeof-attribute.c
new file mode 100644
index 00000000..f79a61c4
--- /dev/null
+++ b/validation/typeof-attribute.c
@@ -0,0 +1,16 @@
+#define __percpu __attribute__((noderef, address_space(3)))
+
+/* Turn v back into a normal var. */
+#define convert(v) \
+ (*(typeof(v) __attribute__((address_space(0), force)) *)(&v))
+
+int main(int argc, char *argv)
+{
+ unsigned int __percpu x;
+
+ convert(x) = 0;
+ return 0;
+}
+/*
+ * check-name: Rusty Russell's typeof attribute casting.
+ */