add bunch of testapps
authorMatthias Braun <matze@braunis.de>
Sat, 31 May 2008 09:02:11 +0000 (09:02 +0000)
committerMatthias Braun <matze@braunis.de>
Sat, 31 May 2008 09:02:11 +0000 (09:02 +0000)
[r19878]

parsetest/cp_error027.c [new file with mode: 0644]
parsetest/cp_error028.c [new file with mode: 0644]
parsetest/cp_error030.c [new file with mode: 0644]
parsetest/cp_error032.c [new file with mode: 0644]
parsetest/shouldpass/toomuchparams.c [new file with mode: 0644]
parsetest/switch.c [new file with mode: 0644]

diff --git a/parsetest/cp_error027.c b/parsetest/cp_error027.c
new file mode 100644 (file)
index 0000000..47ceece
--- /dev/null
@@ -0,0 +1,14 @@
+/* Frontend assert while building initialisers */
+
+union {
+       int i;
+       char a[4];
+} blub = {
+       .a[2] = 9,
+       .i = 23
+};
+
+int main()
+{
+       return 0;
+}
diff --git a/parsetest/cp_error028.c b/parsetest/cp_error028.c
new file mode 100644 (file)
index 0000000..80c80ad
--- /dev/null
@@ -0,0 +1,7 @@
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+
+int main(void) {
+       __int64_t i = 0;
+       return i;
+}
diff --git a/parsetest/cp_error030.c b/parsetest/cp_error030.c
new file mode 100644 (file)
index 0000000..26cac0e
--- /dev/null
@@ -0,0 +1,22 @@
+static int test(int a, int b);
+
+static int adr(int *x);
+
+static int test1(int a, int b) {
+       return test(a,b);
+}
+
+static int test2(int a, int b) {
+       int arr[2];
+
+       arr[0] = a;
+       arr[1] = b;
+
+       adr(arr);
+       return arr[0] + arr[1];
+}
+
+int main(void)
+{
+       return 0;
+}
diff --git a/parsetest/cp_error032.c b/parsetest/cp_error032.c
new file mode 100644 (file)
index 0000000..d5eee95
--- /dev/null
@@ -0,0 +1,6 @@
+int printf(const char *str, ...);
+
+int main(void) {
+       printf("%d\n", (int) sizeof (const void*));
+       return 0;
+}
diff --git a/parsetest/shouldpass/toomuchparams.c b/parsetest/shouldpass/toomuchparams.c
new file mode 100644 (file)
index 0000000..e2ab089
--- /dev/null
@@ -0,0 +1,12 @@
+int puts(const char *str);
+
+int test(s)
+       char *s;
+{
+       puts(s);
+}
+
+int main(void) {
+       test("Hello World", 0);
+       return 0;
+}
diff --git a/parsetest/switch.c b/parsetest/switch.c
new file mode 100644 (file)
index 0000000..426e5d5
--- /dev/null
@@ -0,0 +1,20 @@
+#include <assert.h>
+
+static int switch1(int k) {
+       switch(k) {
+       case 42:
+               return 5;
+       case 13:
+               return 7;
+       }
+       return 3;
+}
+
+int main(void)
+{
+       assert(switch1(42) == 5);
+       assert(switch1(13) == 7);
+       assert(switch1(700) == 3);
+       assert(switch1(-32000) == 3);
+       return 0;
+}