aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorChristopher Li <sparse@chrisli.org>2012-10-11 19:37:23 -0700
committerChristopher Li <sparse@chrisli.org>2012-10-11 19:40:45 -0700
commit122820872558c308549a099066e994ec5ca2ce9e (patch)
tree7e3338775500723939fbda840698eb5eb105be34 /validation
parent063236fd3f46bc83b49172f5ecb597e0a91cede8 (diff)
parentd5bd3662e07343fbd82c05606f4c25951062d1bb (diff)
downloadsparse-dev-122820872558c308549a099066e994ec5ca2ce9e.tar.gz
Merge branch 'llvm/core' of github.com:penberg/sparse-llvm
Please pull the latest Sparse/LLVM tree from: git@github.com:penberg/sparse-llvm.git llvm/core It contains few LLVM backend fixes from myself and Jonathan Neuschäfer.
Diffstat (limited to 'validation')
-rw-r--r--validation/backend/extern.c11
-rw-r--r--validation/backend/int-cond.c30
-rw-r--r--validation/backend/load-type.c12
-rw-r--r--validation/backend/void-return-type.c13
4 files changed, 66 insertions, 0 deletions
diff --git a/validation/backend/extern.c b/validation/backend/extern.c
new file mode 100644
index 00000000..24cbae55
--- /dev/null
+++ b/validation/backend/extern.c
@@ -0,0 +1,11 @@
+extern unsigned long foo;
+
+static unsigned long bar(void)
+{
+ return foo;
+}
+
+/*
+ * check-name: Extern symbol code generation
+ * check-command: ./sparsec -c $file -o tmp.o
+ */
diff --git a/validation/backend/int-cond.c b/validation/backend/int-cond.c
new file mode 100644
index 00000000..48b25a77
--- /dev/null
+++ b/validation/backend/int-cond.c
@@ -0,0 +1,30 @@
+static long foo(long a, long b, long c)
+{
+ return a? b:c;
+}
+
+static long foo_bool(_Bool a, long b, long c)
+{
+ return a? b:c;
+}
+
+static long bar(long a, long b, long c)
+{
+ if (a)
+ return b;
+ else
+ return b + c;
+}
+
+static long bar_bool(_Bool a, long b, long c)
+{
+ if (a)
+ return b;
+ else
+ return b + c;
+}
+
+/*
+ * check-name: Non-bool condition values in branch/select
+ * check-command: ./sparsec -c $file -o tmp.o
+ */
diff --git a/validation/backend/load-type.c b/validation/backend/load-type.c
new file mode 100644
index 00000000..80416cad
--- /dev/null
+++ b/validation/backend/load-type.c
@@ -0,0 +1,12 @@
+extern struct _IO_FILE *stdin;
+
+static void sub(struct _IO_FILE *in) {}
+
+static void test(void) {
+ sub(stdin);
+}
+
+/*
+ * check-name: Type of loaded objects
+ * check-command: ./sparsec -c $file -o tmp.o
+ */
diff --git a/validation/backend/void-return-type.c b/validation/backend/void-return-type.c
new file mode 100644
index 00000000..b282fdee
--- /dev/null
+++ b/validation/backend/void-return-type.c
@@ -0,0 +1,13 @@
+static void foo(void)
+{
+}
+
+static void *bar(void *p)
+{
+ return p;
+}
+
+/*
+ * check-name: void return type code generation
+ * check-command: ./sparsec -c $file -o tmp.o
+ */