aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Li <sparse@chrisli.org>2011-08-23 14:39:47 -0700
committerChristopher Li <sparse@chrisli.org>2011-08-23 14:39:47 -0700
commitd5096c9aa0861b82120c3d24ff526a9c67a83e3b (patch)
treea2d61f8405266d7c6ccc2e08d9ccdb7bc1feb27b
parent181ce0f980cb4693ba8d22b5ba53b727e11c8a30 (diff)
downloadsparse-d5096c9aa0861b82120c3d24ff526a9c67a83e3b.tar.gz
Add test case for empty asm clobbers
This test case is provided by Dave Jones. Sparse currently chokes on it. Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r--validation/asm-empty-clobber.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/asm-empty-clobber.c b/validation/asm-empty-clobber.c
new file mode 100644
index 00000000..eb1e1058
--- /dev/null
+++ b/validation/asm-empty-clobber.c
@@ -0,0 +1,28 @@
+
+# define __ASM_FORM(x) " " #x " "
+# define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
+# define __ASM_SEL(a,b) __ASM_FORM(b)
+#define _ASM_PTR __ASM_SEL(.long, .quad)
+
+# define JUMP_LABEL(key, label) \
+ do { \
+ asm goto("1:" \
+ JUMP_LABEL_INITIAL_NOP \
+ ".pushsection __jump_table, \"a\" \n\t"\
+ _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
+ ".popsection \n\t" \
+ : : "i" (key) : : label); \
+ } while (0)
+
+int main(int argc, char *argv[])
+{
+ JUMP_LABEL("1", do_trace );
+ return 1;
+do_trace:
+ return 0;
+}
+
+/*
+ * check-name: Asm with goto labels.
+ */
+