ref: a0ff31c2362324edf915883b2faa324377be1b4a
parent: 7411192014bae74906a1f1116413a4f578bfaebd
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Oct 6 17:56:43 EDT 2019
[tests] Rename scc to cc Follow with the changes in other places of the code..
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,7 +10,7 @@
size/execute \
strip/execute \
libc/execute \
- scc/execute scc/error
+ cc/execute cc/error
all clean:
$(FORALL)
--- /dev/null
+++ b/tests/cc/error/0001-sanity.c
@@ -1,0 +1,11 @@
+/*
+PATTERN:
+0001-sanity.c:9: error: 'FOO' undeclared
+.
+*/
+
+int main()
+{
+ return FOO;
+}
+
--- /dev/null
+++ b/tests/cc/error/0002-missinginclude.c
@@ -1,0 +1,7 @@
+/*
+PATTERN:
+0002-missinginclude.c:7: error: included file 'MISSING.h' not found
+.
+*/
+
+#include "MISSING.h"
--- /dev/null
+++ b/tests/cc/error/0003-junkinclude.c
@@ -1,0 +1,7 @@
+/*
+PATTERN:
+0003-junkinclude.c:7: error: trailing characters after preprocessor directive
+.
+*/
+
+#include "0003-junkinclude.c" bar
--- /dev/null
+++ b/tests/cc/error/0004-macroredef.c
@@ -1,0 +1,9 @@
+/*
+PATTERN:
+0004-macroredef.c:8: warning: 'X' redefined
+.
+*/
+
+#define X 1
+#define X 2
+
--- /dev/null
+++ b/tests/cc/error/0005-fmacro.c
@@ -1,0 +1,8 @@
+/*
+PATTERN:
+0005-fmacro.c:7: error: macro arguments must be identifiers
+.
+*/
+
+#define X(
+
--- /dev/null
+++ b/tests/cc/error/0006-endif.c
@@ -1,0 +1,8 @@
+/*
+PATTERN:
+0006-endif.c:7: error: #endif without #if
+.
+*/
+
+#endif
+
--- /dev/null
+++ b/tests/cc/error/0007-unmatchedcppif.c
@@ -1,0 +1,9 @@
+/*
+PATTERN:
+
+.
+*/
+
+#ifdef FOO
+
+
--- /dev/null
+++ b/tests/cc/error/0008-unmatchedcppelse.c
@@ -1,0 +1,9 @@
+/*
+PATTERN:
+0008-unmatchedcppelse.c:7: error: #else without #ifdef/ifndef
+.
+*/
+
+#else
+
+
--- /dev/null
+++ b/tests/cc/error/0009-unmatchedcppelif.c
@@ -1,0 +1,8 @@
+/*
+PATTERN:
+
+.
+*/
+
+#elif 1
+
--- /dev/null
+++ b/tests/cc/error/0010-extraelif.c
@@ -1,0 +1,13 @@
+/*
+PATTERN:
+
+.
+*/
+
+#if 1
+
+#else
+
+#elif 0
+
+#endif
--- /dev/null
+++ b/tests/cc/error/0011-extraelse.c
@@ -1,0 +1,13 @@
+/*
+PATTERN:
+
+.
+*/
+
+#if 1
+
+#else
+
+#else
+
+#endif
--- /dev/null
+++ b/tests/cc/error/0012-ifnoexpr.c
@@ -1,0 +1,10 @@
+/*
+PATTERN:
+0012-ifnoexpr.c:7: error: unexpected '
+'
+.
+*/
+
+#if
+#endif
+
--- /dev/null
+++ b/tests/cc/error/0013-macro.c
@@ -1,0 +1,10 @@
+/*
+PATTERN:
+0013-macro.c:9: error: macro "X" received 0 arguments, but it takes 1
+.
+*/
+
+#define X(A, ...) 0
+
+X()
+
--- /dev/null
+++ b/tests/cc/error/0014-macro.c
@@ -1,0 +1,10 @@
+/*
+PATTERN:
+0014-macro.c:9: error: macro "X" received 1 arguments, but it takes 0
+.
+*/
+
+#define X() 0
+
+X(A)
+
--- /dev/null
+++ b/tests/cc/error/0015-macro.c
@@ -1,0 +1,8 @@
+/*
+PATTERN:
+
+.
+*/
+
+#define X(A, A) 0
+
--- /dev/null
+++ b/tests/cc/error/0016-arrayinitsize.c
@@ -1,0 +1,7 @@
+/*
+PATTERN:
+
+.
+*/
+
+int x[2] = {1, 2, 3};
--- /dev/null
+++ b/tests/cc/error/0017-duplicatefunc.c
@@ -1,0 +1,18 @@
+/*
+PATTERN:
+0017-duplicatefunc.c:15: error: redefinition of 'main'
+.
+*/
+
+int
+main()
+{
+ return 0;
+}
+
+int
+main()
+{
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/error/0018-voidparam.c
@@ -1,0 +1,36 @@
+/*
+PATTERN:
+0018-voidparam.c:27: error: a named argument is requiered before '...'
+.
+*/
+
+
+int
+a(void, int i)
+{
+ return 0;
+}
+
+int
+b(int i, void)
+{
+ return 0;
+}
+
+int
+c(void, void)
+{
+ return 0;
+}
+
+int
+d(void, ...)
+{
+ return 0;
+}
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/error/0019-kr_names.c
@@ -1,0 +1,21 @@
+/*
+PATTERN:
+0019-kr_names.c:9: warning: parameter names (without types) in function declaration
+0019-kr_names.c:13: warning: type of 'a' defaults to int
+0019-kr_names.c:13: warning: type of 'c' defaults to int
+.
+*/
+
+int f(a,b);
+
+int
+f(a,b,c) char b;
+{
+ return a - c + b;
+}
+
+int
+main(void)
+{
+ return f(1,0,1);
+}
--- /dev/null
+++ b/tests/cc/error/0020-storage.c
@@ -1,0 +1,37 @@
+int a;
+static char b;
+extern int c;
+typedef unsigned e;
+
+int
+func1(void)
+{
+ auto h;
+ static char i;
+ register long j;
+ extern int k;
+ static unsigned long a;
+ return 0;
+}
+
+void
+func2(register int par)
+{
+ int par;
+}
+
+static void
+func3(register int par)
+{
+}
+
+register short d;
+
+register void
+func4(static int par)
+{
+ static register f;
+}
+
+short d;
+char d;
--- /dev/null
+++ b/tests/cc/error/0021-namespace.c
@@ -1,0 +1,29 @@
+typedef struct s s;
+
+struct s {
+ struct s1 {
+ int s;
+ struct s2 {
+ int s;
+ } s1;
+ } s;
+} s2;
+
+#define s s
+
+int
+main(void)
+{
+#undef s
+ goto s;
+ struct s s;
+ {
+ int s;
+ return s;
+ }
+ return s.s.s + s.s.s1.s;
+ s:
+ {
+ s: return 0;
+ }
+}
--- /dev/null
+++ b/tests/cc/error/0021-void.c
@@ -1,0 +1,7 @@
+int
+main(void)
+{
+ void f(void);
+
+ return (int) f();
+}
--- /dev/null
+++ b/tests/cc/error/0022-cpp-if.c
@@ -1,0 +1,9 @@
+#if 3 != (1,2,3)
+ #error 3 != (1,2,3)
+#endif
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/error/0023-include.c
@@ -1,0 +1,6 @@
+/*
+ * Test a comment that goes beyond of the end of an
+ * included file
+ */
+
+#include "0023-include.h"
--- /dev/null
+++ b/tests/cc/error/0023-include.h
@@ -1,0 +1,8 @@
+#ifndef TEST_H_
+#define TEST_H_
+
+/*
+ This is an unterminated comment.
+
+
+#endif
--- /dev/null
+++ b/tests/cc/error/Makefile
@@ -1,0 +1,11 @@
+.POSIX:
+
+ROOT=../../../root
+
+all: tests
+
+tests:
+ @CFLAGS='' SCCPREFIX=$(ROOT) PATH=$(ROOT)/bin:$$PATH chktest.sh scc-tests.lst
+
+clean:
+ rm -f *.as *.o *.ir *.qbe *core test.log
--- /dev/null
+++ b/tests/cc/error/README
@@ -1,0 +1,2 @@
+These tests are taken from https://github.com/andrewchambers/qc.
+All the credits for this test suite are for Andrew Chambers.
--- /dev/null
+++ b/tests/cc/error/chktest.sh
@@ -1,0 +1,21 @@
+#!/bin/sh
+
+file=${1?' empty input file'}
+err=/tmp/$$.err
+chk=/tmp/$$.chk
+
+trap "rm -f a.out *.o $chk $err; exit" 0 1 2 3 15
+ulimit -c 0
+rm -f test.log
+
+while read i state
+do
+ echo $i >> test.log
+ state=${state:-"\t"}
+
+ scc $CFLAGS -w -c $i 2> $err
+ echo "/^PATTERN/+;/^\./-w $chk" | ed -s $i
+ diff -c $chk $err >> test.log && printf '[PASS]' || echo '[FAIL]'
+ printf "%s\t%s\n" "$state" "$i"
+ rm -f *.o
+done < $file
--- /dev/null
+++ b/tests/cc/error/scc-tests.lst
@@ -1,0 +1,23 @@
+0001-sanity.c
+0002-missinginclude.c
+0003-junkinclude.c
+0004-macroredef.c
+0005-fmacro.c
+0006-endif.c
+0007-unmatchedcppif.c [TODO]
+0008-unmatchedcppelse.c
+0009-unmatchedcppelif.c [TODO]
+0010-extraelif.c [TODO]
+0011-extraelse.c [TODO]
+0012-ifnoexpr.c [TODO]
+0013-macro.c
+0014-macro.c
+0015-macro.c [TODO]
+0016-arrayinitsize.c [TODO]
+0017-duplicatefunc.c
+0018-voidparam.c [TODO]
+0019-kr_names.c
+0020-storage.c [TODO]
+0021-void.c [TODO]
+0022-cpp-if.c [TODO]
+0023-include.c [TODO]
--- /dev/null
+++ b/tests/cc/error/update.sh
@@ -1,0 +1,10 @@
+#!/bin/sh
+
+for i
+do
+ (echo '/^PATTERN/+;/^\./-c'
+ scc $CFLAGS -w -c $i 2>&1
+ printf ".\nw\n"
+ echo w) |
+ ed -s $i
+done
--- /dev/null
+++ b/tests/cc/execute/0001-sanity.c
@@ -1,0 +1,5 @@
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0002-expr.c
@@ -1,0 +1,5 @@
+int
+main()
+{
+ return 3-3;
+}
--- /dev/null
+++ b/tests/cc/execute/0003-local.c
@@ -1,0 +1,8 @@
+int
+main()
+{
+ int x;
+
+ x = 4;
+ return x - 4;
+}
--- /dev/null
+++ b/tests/cc/execute/0004-pointer.c
@@ -1,0 +1,12 @@
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 4;
+ p = &x;
+ *p = 0;
+
+ return *p;
+}
--- /dev/null
+++ b/tests/cc/execute/0005-ifstmt.c
@@ -1,0 +1,23 @@
+int
+main()
+{
+ int x;
+ int *p;
+ int **pp;
+
+ x = 0;
+ p = &x;
+ pp = &p;
+
+ if(*p)
+ return 1;
+ if(**pp)
+ return 1;
+ else
+ **pp = 1;
+
+ if(x)
+ return 0;
+ else
+ return 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0006-whilestmt.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x;
+
+ x = 50;
+ while (x)
+ x = x - 1;
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0007-forstmt.c
@@ -1,0 +1,15 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ for(x = 10; x; x = x - 1)
+ ;
+ if(x)
+ return 1;
+ x = 10;
+ for (;x;)
+ x = x - 1;
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0008-dowhilestmt.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int x;
+
+ x = 50;
+ do
+ x = x - 1;
+ while(x);
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0009-expr.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x * 10;
+ x = x / 2;
+ x = x % 3;
+ return x - 2;
+}
--- /dev/null
+++ b/tests/cc/execute/0010-goto.c
@@ -1,0 +1,13 @@
+int
+main()
+{
+ start:
+ goto next;
+ return 1;
+ success:
+ return 0;
+ next:
+ foo:
+ goto success;
+ return 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0011-assign.c
@@ -1,0 +1,8 @@
+int
+main()
+{
+ int x;
+ int y;
+ x = y = 0;
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0012-expr.c
@@ -1,0 +1,5 @@
+int
+main()
+{
+ return (2 + 2) * 2 - 8;
+}
--- /dev/null
+++ b/tests/cc/execute/0013-addridx.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 0;
+ p = &x;
+ return p[0];
+}
--- /dev/null
+++ b/tests/cc/execute/0014-assignidx.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int x;
+ int *p;
+
+ x = 1;
+ p = &x;
+ p[0] = 0;
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0015-localarray.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int arr[2];
+
+ arr[0] = 1;
+ arr[1] = 2;
+
+ return arr[0] + arr[1] - 3;
+}
--- /dev/null
+++ b/tests/cc/execute/0016-addrarray.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[1];
+ *p = 0;
+ return arr[1];
+}
--- /dev/null
+++ b/tests/cc/execute/0017-struct.c
@@ -1,0 +1,9 @@
+int
+main()
+{
+ struct { int x; int y; } s;
+
+ s.x = 3;
+ s.y = 5;
+ return s.y - s.x - 2;
+}
--- /dev/null
+++ b/tests/cc/execute/0018-structptr.c
@@ -1,0 +1,13 @@
+int
+main()
+{
+
+ struct S { int x; int y; } s;
+ struct S *p;
+
+ p = &s;
+ s.x = 1;
+ p->y = 2;
+ return p->y + p->x - 3;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0019-selfrefstruct.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ struct S { struct S *p; int x; } s;
+
+ s.x = 0;
+ s.p = &s;
+ return s.p->p->p->p->p->x;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0020-ptrptr.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x, *p, **pp;
+
+ x = 0;
+ p = &x;
+ pp = &p;
+ return **pp;
+}
--- /dev/null
+++ b/tests/cc/execute/0021-intfunc.c
@@ -1,0 +1,12 @@
+int
+foo(int a, int b)
+{
+ return 2 + a - b;
+}
+
+int
+main()
+{
+ return foo(1, 3);
+}
+
--- /dev/null
+++ b/tests/cc/execute/0022-typedef.c
@@ -1,0 +1,10 @@
+typedef int x;
+
+int
+main()
+{
+ x v;
+ v = 0;
+ return v;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0023-global.c
@@ -1,0 +1,9 @@
+int x;
+
+int
+main()
+{
+ x = 0;
+ return x;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0024-typedefstruct.c
@@ -1,0 +1,12 @@
+typedef struct { int x; int y; } s;
+
+s v;
+
+int
+main()
+{
+ v.x = 1;
+ v.y = 2;
+ return 3 - v.x - v.y;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0025-string.c
@@ -1,0 +1,10 @@
+int strlen(char *);
+
+int
+main()
+{
+ char *p;
+
+ p = "hello";
+ return strlen(p) - 5;
+}
--- /dev/null
+++ b/tests/cc/execute/0026-implicitret.c
@@ -1,0 +1,5 @@
+main()
+{
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0027-charval.c
@@ -1,0 +1,8 @@
+int
+main()
+{
+ char *p;
+
+ p = "hello";
+ return p[0] - 104;
+}
--- /dev/null
+++ b/tests/cc/execute/0028-bor.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x | 4;
+ return x - 5;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0029-band.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x & 3;
+ return x - 1;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0030-bxor.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ x = x ^ 3;
+ return x - 2;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0031-relop.c
@@ -1,0 +1,24 @@
+int
+f()
+{
+ return 100;
+}
+
+int
+main()
+{
+ if (f() > 1000)
+ return 1;
+ if (f() >= 1000)
+ return 1;
+ if (1000 < f())
+ return 1;
+ if (1000 <= f())
+ return 1;
+ if (1000 == f())
+ return 1;
+ if (100 != f())
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0032-indec.c
@@ -1,0 +1,48 @@
+int
+zero()
+{
+ return 0;
+}
+
+int
+one()
+{
+ return 1;
+}
+
+int
+main()
+{
+ int x;
+ int y;
+
+ x = zero();
+ y = ++x;
+ if (x != 1)
+ return 1;
+ if (y != 1)
+ return 1;
+
+ x = one();
+ y = --x;
+ if (x != 0)
+ return 1;
+ if (y != 0)
+ return 1;
+
+ x = zero();
+ y = x++;
+ if (x != 1)
+ return 1;
+ if (y != 0)
+ return 1;
+
+ x = one();
+ y = x--;
+ if (x != 0)
+ return 1;
+ if (y != 1)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0033-ptrindec.c
@@ -1,0 +1,30 @@
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ arr[0] = 2;
+ arr[1] = 3;
+ p = &arr[0];
+ if(*(p++) != 2)
+ return 1;
+ if(*(p++) != 3)
+ return 2;
+
+ p = &arr[1];
+ if(*(p--) != 3)
+ return 1;
+ if(*(p--) != 2)
+ return 2;
+
+ p = &arr[0];
+ if(*(++p) != 3)
+ return 1;
+
+ p = &arr[1];
+ if(*(--p) != 2)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0034-logandor.c
@@ -1,0 +1,45 @@
+int g;
+
+int
+effect()
+{
+ g = 1;
+ return 1;
+}
+
+int
+main()
+{
+ int x;
+
+ g = 0;
+ x = 0;
+ if(x && effect())
+ return 1;
+ if(g)
+ return 2;
+ x = 1;
+ if(x && effect()) {
+ if(g != 1)
+ return 3;
+ } else {
+ return 4;
+ }
+ g = 0;
+ x = 1;
+ if(x || effect()) {
+ if(g)
+ return 5;
+ } else {
+ return 6;
+ }
+ x = 0;
+ if(x || effect()) {
+ if(g != 1)
+ return 7;
+ } else {
+ return 8;
+ }
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0035-breakcont.c
@@ -1,0 +1,32 @@
+int
+main()
+{
+ int x;
+
+ x = 0;
+ while(1)
+ break;
+ while(1) {
+ if (x == 5) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ }
+ for (;;) {
+ if (x == 10) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ }
+ do {
+ if (x == 15) {
+ break;
+ }
+ x = x + 1;
+ continue;
+ } while(1);
+ return x - 15;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0036-notneg.c
@@ -1,0 +1,15 @@
+int
+main()
+{
+ int x;
+
+ x = 4;
+ if(!x != 0)
+ return 1;
+ if(!!x != 1)
+ return 1;
+ if(-x != 0 - 4)
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0037-assignop.c
@@ -1,0 +1,19 @@
+int
+main()
+{
+ int x;
+
+ x = 0;
+ x += 2;
+ x += 2;
+ if (x != 4)
+ return 1;
+ x -= 1;
+ if (x != 3)
+ return 2;
+ x *= 2;
+ if (x != 6)
+ return 3;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0038-ptradd.c
@@ -1,0 +1,17 @@
+int
+main()
+{
+ int x[2];
+ int *p;
+
+ x[1] = 7;
+ p = &x[0];
+ p = p + 1;
+
+ if(*p != 7)
+ return 1;
+ if(&x[1] - &x[0] != 1)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0039-sizeof.c
@@ -1,0 +1,17 @@
+int
+main()
+{
+ int x, *p;
+
+ if (sizeof(0) < 2)
+ return 1;
+ if (sizeof 0 < 2)
+ return 1;
+ if (sizeof(char) < 1)
+ return 1;
+ if (sizeof(int) - 2 < 0)
+ return 1;
+ if (sizeof(&x) != sizeof p)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0040-cast.c
@@ -1,0 +1,13 @@
+int
+main()
+{
+ void *p;
+ int x;
+
+ x = 2;
+ p = &x;
+
+ if(*((int*)p) != 2)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0041-queen.c
@@ -1,0 +1,55 @@
+int *calloc(int, int);
+
+int N;
+int *t;
+
+int
+chk(int x, int y)
+{
+ int i;
+ int r;
+
+ for (r=i=0; i<8; i++) {
+ r = r + t[x + 8*i];
+ r = r + t[i + 8*y];
+ if (x+i < 8 & y+i < 8)
+ r = r + t[x+i + 8*(y+i)];
+ if (x+i < 8 & y-i >= 0)
+ r = r + t[x+i + 8*(y-i)];
+ if (x-i >= 0 & y+i < 8)
+ r = r + t[x-i + 8*(y+i)];
+ if (x-i >= 0 & y-i >= 0)
+ r = r + t[x-i + 8*(y-i)];
+ }
+ return r;
+}
+
+int
+go(int n, int x, int y)
+{
+ if (n == 8) {
+ N++;
+ return 0;
+ }
+ for (; y<8; y++) {
+ for (; x<8; x++)
+ if (chk(x, y) == 0) {
+ t[x + 8*y]++;
+ go(n+1, x, y);
+ t[x + 8*y]--;
+ }
+ x = 0;
+ }
+ return 0;
+}
+
+int
+main()
+{
+ t = calloc(64, sizeof(int));
+ go(0, 0, 0);
+ if(N != 92)
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0042-prime.c
@@ -1,0 +1,26 @@
+int
+main() {
+ int n;
+ int t;
+ int c;
+ int p;
+
+ c = 0;
+ n = 2;
+ while (n < 5000) {
+ t = 2;
+ p = 1;
+ while (t*t <= n) {
+ if (n % t == 0)
+ p = 0;
+ t++;
+ }
+ n++;
+ if (p)
+ c++;
+ }
+ if (c != 669)
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0043-union.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ union { int a; int b; } u;
+ u.a = 1;
+ u.b = 3;
+
+ if (u.a != 3 || u.b != 3)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0044-struct.c
@@ -1,0 +1,19 @@
+struct s {
+ int x;
+ struct {
+ int y;
+ int z;
+ } nest;
+};
+
+int
+main() {
+ struct s v;
+ v.x = 1;
+ v.nest.y = 2;
+ v.nest.z = 3;
+ if (v.x + v.nest.y + v.nest.z != 6)
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0045-struct.c
@@ -1,0 +1,16 @@
+struct T;
+
+struct T {
+ int x;
+};
+
+int
+main()
+{
+ struct T v;
+ { struct T { int z; }; }
+ v.x = 2;
+ if(v.x != 2)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0046-inits.c
@@ -1,0 +1,16 @@
+int x = 5;
+long y = 6;
+int *p = &x;
+
+int
+main()
+{
+ if (x != 5)
+ return 1;
+ if (y != 6)
+ return 2;
+ if (*p != 5)
+ return 3;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0047-anonexport.c
@@ -1,0 +1,34 @@
+typedef struct {
+ int a;
+ union {
+ int b1;
+ int b2;
+ };
+ struct { union { struct { int c; }; struct {}; }; };
+ struct {};
+ struct {
+ int d;
+ };
+} s;
+
+int
+main()
+{
+ s v;
+
+ v.a = 1;
+ v.b1 = 2;
+ v.c = 3;
+ v.d = 4;
+
+ if (v.a != 1)
+ return 1;
+ if (v.b1 != 2 && v.b2 != 2)
+ return 2;
+ if (v.c != 3)
+ return 3;
+ if (v.d != 4)
+ return 4;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0048-inits.c
@@ -1,0 +1,14 @@
+struct { int a; int b; int c; } s = {1, 2, 3};
+
+int
+main()
+{
+ if (s.a != 1)
+ return 1;
+ if (s.b != 2)
+ return 2;
+ if (s.c != 3)
+ return 3;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0049-inits.c
@@ -1,0 +1,12 @@
+struct S {int a; int b;};
+struct S s = { .b = 2, .a = 1};
+
+int
+main()
+{
+ if(s.a != 1)
+ return 1;
+ if(s.b != 2)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0050-inits.c
@@ -1,0 +1,14 @@
+int x = 10;
+
+struct S {int a; int *p;};
+struct S s = { .p = &x, .a = 1};
+
+int
+main()
+{
+ if(s.a != 1)
+ return 1;
+ if(*s.p != 10)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0051-inits.c
@@ -1,0 +1,33 @@
+struct S1 {
+ int a;
+ int b;
+};
+
+struct S2 {
+ int a;
+ int b;
+ union {
+ int c;
+ int d;
+ };
+ struct S1 s;
+};
+
+struct S2 v = {1, 2, 3, {4, 5}};
+
+int
+main()
+{
+ if(v.a != 1)
+ return 1;
+ if(v.b != 2)
+ return 2;
+ if(v.c != 3 || v.d != 3)
+ return 3;
+ if(v.s.a != 4)
+ return 4;
+ if(v.s.b != 5)
+ return 5;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0052-switch.c
@@ -1,0 +1,38 @@
+int x = 0;
+
+int
+main()
+{
+ switch(x)
+ case 0:
+ ;
+ switch(x)
+ case 0:
+ switch(x) {
+ case 0:
+ goto next;
+ default:
+ return 1;
+ }
+ return 1;
+ next:
+ switch(x)
+ case 1:
+ return 1;
+ switch(x) {
+ {
+ x = 1 + 1;
+ foo:
+ case 1:
+ return 1;
+ }
+ }
+ switch(x) {
+ case 0:
+ return x;
+ case 1:
+ return 1;
+ default:
+ return 1;
+ }
+}
--- /dev/null
+++ b/tests/cc/execute/0053-struct.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ struct T { int x; };
+ {
+ struct T s;
+ s.x = 0;
+ return s.x;
+ }
+}
--- /dev/null
+++ b/tests/cc/execute/0054-struct.c
@@ -1,0 +1,13 @@
+int
+main()
+{
+ struct T { int x; } s1;
+ s1.x = 1;
+ {
+ struct T { int y; } s2;
+ s2.y = 1;
+ if (s1.x - s2.y != 0)
+ return 1;
+ }
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0055-enum.c
@@ -1,0 +1,22 @@
+enum E {
+ x,
+ y,
+ z,
+};
+
+int
+main()
+{
+ enum E e;
+
+ if(x != 0)
+ return 1;
+ if(y != 1)
+ return 2;
+ if(z != 2)
+ return 3;
+
+ e = x;
+ return e;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0056-enum.c
@@ -1,0 +1,22 @@
+enum E {
+ x,
+ y = 2,
+ z,
+};
+
+int
+main()
+{
+ enum E e;
+
+ if(x != 0)
+ return 1;
+ if(y != 2)
+ return 2;
+ if(z != 3)
+ return 3;
+
+ e = x;
+ return e;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0057-duff.c
@@ -1,0 +1,30 @@
+int main()
+{
+ int count, n;
+ char *from, *to;
+ char a[39], b[39];
+
+ for(n = 0; n < 39; n++) {
+ a[n] = n;
+ b[n] = 0;
+ }
+ from = a;
+ to = b;
+ count = 39;
+ n = (count + 7) / 8;
+ switch (count % 8) {
+ case 0: do { *to++ = *from++;
+ case 7: *to++ = *from++;
+ case 6: *to++ = *from++;
+ case 5: *to++ = *from++;
+ case 4: *to++ = *from++;
+ case 3: *to++ = *from++;
+ case 2: *to++ = *from++;
+ case 1: *to++ = *from++;
+ } while (--n > 0);
+ }
+ for(n = 0; n < 39; n++)
+ if(a[n] != b[n])
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0058-bug.c
@@ -1,0 +1,9 @@
+int
+main()
+{
+ char a[16], b[16];
+
+ if(sizeof(a) != sizeof(b))
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0059-multistring.c
@@ -1,0 +1,15 @@
+int main()
+{
+ char * s;
+
+ s = "abc" "def";
+ if(s[0] != 'a') return 1;
+ if(s[1] != 'b') return 2;
+ if(s[2] != 'c') return 3;
+ if(s[3] != 'd') return 4;
+ if(s[4] != 'e') return 5;
+ if(s[5] != 'f') return 6;
+ if(s[6] != 0) return 7;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0060-charlit.c
@@ -1,0 +1,8 @@
+int
+main()
+{
+ if ('a' != 97)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0061-comments.c
@@ -1,0 +1,11 @@
+// line comment
+
+int
+main()
+{
+ /*
+ multiline
+ comment
+ */
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0062-include.c
@@ -1,0 +1,4 @@
+#include \
+"include/0062-include.h"
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0063-define.c
@@ -1,0 +1,7 @@
+#define FOO 0
+
+int main()
+{
+ return FOO;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0064-sysinclude.c
@@ -1,0 +1,7 @@
+#include <0064-sysinclude.h>
+
+int
+main()
+{
+ return x - y;
+}
--- /dev/null
+++ b/tests/cc/execute/0065-ifdef.c
@@ -1,0 +1,25 @@
+#ifdef FOO
+ XXX
+#ifdef BAR
+ XXX
+#endif
+ XXX
+#endif
+
+#define FOO 1
+
+#ifdef FOO
+
+#ifdef FOO
+int x = 0;
+#endif
+
+int
+main()
+{
+ return x;
+}
+#endif
+
+
+
--- /dev/null
+++ b/tests/cc/execute/0066-cppelse.c
@@ -1,0 +1,20 @@
+#define BAR 0
+#ifdef BAR
+ #ifdef FOO
+ XXX
+ #ifdef FOO
+ XXX
+ #endif
+ #else
+ #define FOO
+ #ifdef FOO
+ int x = BAR;
+ #endif
+ #endif
+#endif
+
+int
+main()
+{
+ return BAR;
+}
--- /dev/null
+++ b/tests/cc/execute/0067-define.c
@@ -1,0 +1,7 @@
+#define X 6 / 2
+
+int
+main()
+{
+ return X - 3;
+}
--- /dev/null
+++ b/tests/cc/execute/0068-funclikemacro.c
@@ -1,0 +1,8 @@
+#define ADD(X, Y) (X + Y)
+
+
+int
+main()
+{
+ return ADD(1, 2) - 3;
+}
--- /dev/null
+++ b/tests/cc/execute/0069-funclikemacro.c
@@ -1,0 +1,11 @@
+#define A 3
+#define FOO(X,Y,Z) X + Y + Z
+#define SEMI ;
+
+int
+main()
+{
+ if(FOO(1, 2, A) != 6)
+ return 1 SEMI
+ return FOO(0,0,0);
+}
--- /dev/null
+++ b/tests/cc/execute/0070-cppif.c
@@ -1,0 +1,18 @@
+#if 1
+int x = 0;
+#endif
+
+#if 0
+int x = 1;
+#if 1
+ X
+#endif
+#ifndef AAA
+ X
+#endif
+#endif
+
+int main()
+{
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0071-cppelif.c
@@ -1,0 +1,13 @@
+#if 0
+X
+#elif 1
+int x = 0;
+#else
+X
+#endif
+
+int
+main()
+{
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0072-cppelif.c
@@ -1,0 +1,13 @@
+#if 0
+X
+#elif 0
+X
+#elif 1
+int x = 0;
+#endif
+
+int
+main()
+{
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0073-ifndef.c
@@ -1,0 +1,15 @@
+#ifndef DEF
+int x = 0;
+#endif
+
+#define DEF
+
+#ifndef DEF
+X
+#endif
+
+int
+main()
+{
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0074-undef.c
@@ -1,0 +1,12 @@
+#define X 1
+#undef X
+
+#ifdef X
+FAIL
+#endif
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0075-ptraddasn.c
@@ -1,0 +1,14 @@
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[0];
+ p += 1;
+ *p = 123;
+
+ if(arr[1] != 123)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0076-ptrsubasn.c
@@ -1,0 +1,14 @@
+int
+main()
+{
+ int arr[2];
+ int *p;
+
+ p = &arr[1];
+ p -= 1;
+ *p = 123;
+
+ if(arr[0] != 123)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0077-defined.c
@@ -1,0 +1,32 @@
+#if defined X
+X
+#endif
+
+#if defined(X)
+X
+#endif
+
+#if X
+X
+#endif
+
+#define X 0
+
+#if X
+X
+#endif
+
+#if defined(X)
+int x = 0;
+#endif
+
+#undef X
+#define X 1
+
+#if X
+int
+main()
+{
+ return 0;
+}
+#endif
--- /dev/null
+++ b/tests/cc/execute/0078-dirifexpr.c
@@ -1,0 +1,166 @@
+#if (-2) != -2
+#error fail
+#endif
+
+#if (0 || 0) != 0
+#error fail
+#endif
+
+#if (1 || 0) != 1
+#error fail
+#endif
+
+#if (1 || 1) != 1
+#error fail
+#endif
+
+#if (0 && 0) != 0
+#error fail
+#endif
+
+#if (1 && 0) != 0
+#error fail
+#endif
+
+#if (0 && 1) != 0
+#error fail
+#endif
+
+#if (1 && 1) != 1
+#error fail
+#endif
+
+#if (0xf0 | 1) != 0xf1
+#error fail
+#endif
+
+#if (0xf0 & 1) != 0
+#error fail
+#endif
+
+#if (0xf0 & 0x1f) != 0x10
+#error fail
+#endif
+
+#if (1 ^ 1) != 0
+#error fail
+#endif
+
+#if (1 == 1) != 1
+#error fail
+#endif
+
+#if (1 == 0) != 0
+#error fail
+#endif
+
+#if (1 != 1) != 0
+#error fail
+#endif
+
+#if (0 != 1) != 1
+#error fail
+#endif
+
+#if (0 > 1) != 0
+#error fail
+#endif
+
+#if (0 < 1) != 1
+#error fail
+#endif
+
+#if (0 > -1) != 1
+#error fail
+#endif
+
+#if (0 < -1) != 0
+#error fail
+#endif
+
+#if (0 >= 1) != 0
+#error fail
+#endif
+
+#if (0 <= 1) != 1
+#error fail
+#endif
+
+#if (0 >= -1) != 1
+#error fail
+#endif
+
+#if (0 <= -1) != 0
+#error fail
+#endif
+
+#if (0 < 0) != 0
+#error fail
+#endif
+
+#if (0 <= 0) != 1
+#error fail
+#endif
+
+#if (0 > 0) != 0
+#error fail
+#endif
+
+#if (0 >= 0) != 1
+#error fail
+#endif
+
+#if (1 << 1) != 2
+#error fail
+#endif
+
+#if (2 >> 1) != 1
+#error fail
+#endif
+
+#if (2 + 1) != 3
+#error fail
+#endif
+
+#if (2 - 3) != -1
+#error fail
+#endif
+
+#if (2 * 3) != 6
+#error fail
+#endif
+
+#if (6 / 3) != 2
+#error fail
+#endif
+
+#if (7 % 3) != 1
+#error fail
+#endif
+
+#if (2+2*3+2) != 10
+#error fail
+#endif
+
+#if ((2+2)*(3+2)) != 20
+#error fail
+#endif
+
+#if (2 + 2 + 2 + 2 == 2 + 2 * 3) != 1
+#error fail
+#endif
+
+#if (0 ? 1 : 3) != 3
+#error fail
+#endif
+
+#if (1 ? 3 : 1) != 3
+#error fail
+#endif
+
+int
+main()
+{
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0079-cond.c
@@ -1,0 +1,9 @@
+int
+main()
+{
+ if(0 ? 1 : 0)
+ return 1;
+ if(1 ? 0 : 1)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0080-arrays.c
@@ -1,0 +1,48 @@
+int
+foo(int x[100])
+{
+ int y[100];
+ int *p;
+
+ y[0] = 2000;
+
+ if(x[0] != 1000)
+ {
+ return 1;
+ }
+
+ p = x;
+
+ if(p[0] != 1000)
+ {
+ return 2;
+ }
+
+ p = y;
+
+ if(p[0] != 2000)
+ {
+ return 3;
+ }
+
+ if(sizeof(x) != sizeof(void*))
+ {
+ return 4;
+ }
+
+ if(sizeof(y) <= sizeof(x))
+ {
+ return 5;
+ }
+
+ return 0;
+}
+
+int
+main()
+{
+ int x[100];
+ x[0] = 1000;
+
+ return foo(x);
+}
--- /dev/null
+++ b/tests/cc/execute/0081-calls.c
@@ -1,0 +1,17 @@
+int
+f1(char *p)
+{
+ return *p+1;
+}
+
+int
+main()
+{
+ char s = 1;
+ int v[1000];
+ int f1(char *);
+
+ if (f1(&s) != 2)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0082-bug.c
@@ -1,0 +1,17 @@
+#define x(y) ((y) + 1)
+
+int
+main()
+{
+ int x;
+ int y;
+
+ y = 0;
+ x = x(y);
+
+ if(x != 1)
+ return 1;
+
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0083-voidret.c
@@ -1,0 +1,12 @@
+void
+voidfn()
+{
+ return;
+}
+
+int
+main()
+{
+ voidfn();
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0084-longlong.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ long long x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0085-ulonglong.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ unsigned long long x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0086-variadic.c
@@ -1,0 +1,55 @@
+#define CALL(FUN, ...) FUN(__VA_ARGS__)
+
+int
+none()
+{
+ return 0;
+}
+
+int
+one(int a)
+{
+ if (a != 1)
+ return 1;
+
+ return 0;
+}
+
+int
+two(int a, int b)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+
+ return 0;
+}
+
+int
+three(int a, int b, int c)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+ if (c != 3)
+ return 1;
+
+ return 0;
+}
+
+int
+main()
+{
+ if (CALL(none))
+ return 1;
+ if (CALL(one, 1))
+ return 2;
+ if (CALL(two, 1, 2))
+ return 3;
+ if (CALL(three, 1, 2, 3))
+ return 4;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0087-variadic.c
@@ -1,0 +1,54 @@
+#define ARGS(...) __VA_ARGS__
+
+int
+none()
+{
+ return 0;
+}
+
+int
+one(int a)
+{
+ if (a != 1)
+ return 1;
+
+ return 0;
+}
+
+int
+two(int a, int b)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+
+ return 0;
+}
+
+int
+three(int a, int b, int c)
+{
+ if (a != 1)
+ return 1;
+ if (b != 2)
+ return 1;
+ if (c != 3)
+ return 1;
+
+ return 0;
+}
+
+int
+main()
+{
+ if (none(ARGS()))
+ return 1;
+ if (one(ARGS(1)))
+ return 2;
+ if (two(ARGS(1, 2)))
+ return 3;
+ if (three(ARGS(1, 2, 3)))
+ return 4;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0088-macros.c
@@ -1,0 +1,30 @@
+#define ZERO_0() 0
+#define ZERO_1(A) 0
+#define ZERO_2(A, B) 0
+#define ZERO_VAR(...) 0
+#define ZERO_1_VAR(A, ...) 0
+
+int
+main()
+{
+ if (ZERO_0())
+ return 1;
+ if (ZERO_1(1))
+ return 1;
+ if (ZERO_2(1, 2))
+ return 1;
+ if (ZERO_VAR())
+ return 1;
+ if (ZERO_VAR(1))
+ return 1;
+ if (ZERO_VAR(1, 2))
+ return 1;
+ if (ZERO_1_VAR(1))
+ return 1;
+ if (ZERO_1_VAR(1, 2))
+ return 1;
+ if (ZERO_1_VAR(1, 2, 3))
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0089-short.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ short x;
+
+ x = 0;
+ x = x + 1;
+ if (x != 1)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0090-fptr.c
@@ -1,0 +1,20 @@
+struct S
+{
+ int (*fptr)();
+};
+
+int
+foo()
+{
+ return 0;
+}
+
+int
+main()
+{
+ struct S v;
+
+ v.fptr = foo;
+ return v.fptr();
+}
+
--- /dev/null
+++ b/tests/cc/execute/0091-fptr.c
@@ -1,0 +1,11 @@
+int (*fptr)() = 0;
+
+
+int
+main()
+{
+ if (fptr)
+ return 1;
+ return 0;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0092-fptr.c
@@ -1,0 +1,30 @@
+int
+zero()
+{
+ return 0;
+}
+
+struct S
+{
+ int (*zerofunc)();
+} s = { &zero };
+
+struct S *
+anon()
+{
+ return &s;
+}
+
+typedef struct S * (*fty)();
+
+fty
+go()
+{
+ return &anon;
+}
+
+int
+main()
+{
+ return go()()->zerofunc();
+}
--- /dev/null
+++ b/tests/cc/execute/0093-arrayinit.c
@@ -1,0 +1,14 @@
+int a[3] = {0, 1, 2};
+
+int
+main()
+{
+ if (a[0] != 0)
+ return 1;
+ if (a[1] != 1)
+ return 2;
+ if (a[2] != 2)
+ return 3;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0094-arrayinit.c
@@ -1,0 +1,19 @@
+typedef struct {
+ int v;
+ int sub[2];
+} S;
+
+S a[1] = {{1, {2, 3}}};
+
+int
+main()
+{
+ if (a[0].v != 1)
+ return 1;
+ if (a[0].sub[0] != 2)
+ return 2;
+ if (a[0].sub[1] != 3)
+ return 3;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0095-arrayselector.c
@@ -1,0 +1,19 @@
+int a[] = {5, [2] = 2, 3};
+
+int
+main()
+{
+ if (sizeof(a) != 4*sizeof(int))
+ return 1;
+
+ if (a[0] != 5)
+ return 2;
+ if (a[1] != 0)
+ return 3;
+ if (a[2] != 2)
+ return 4;
+ if (a[3] != 3)
+ return 5;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0096-inferredarraysize.c
@@ -1,0 +1,10 @@
+int a[] = {1, 2, 3, 4};
+
+int
+main()
+{
+ if (sizeof(a) != 4*sizeof(int))
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0097-extern.c
@@ -1,0 +1,6 @@
+extern int x;
+
+int main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0098-tentative.c
@@ -1,0 +1,22 @@
+int x;
+int x = 3;
+int x;
+
+int main();
+
+void *
+foo()
+{
+ return &main;
+}
+
+int
+main()
+{
+ if (x != 3)
+ return 0;
+
+ x = 0;
+ return x;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0099-tentative.c
@@ -1,0 +1,12 @@
+int x, x = 3, x;
+
+int
+main()
+{
+ if (x != 3)
+ return 0;
+
+ x = 0;
+ return x;
+}
+
--- /dev/null
+++ b/tests/cc/execute/0100-redeclaremacro.c
@@ -1,0 +1,14 @@
+#define NULL ((void*)0)
+#define NULL ((void*)0)
+
+#define FOO(X, Y) (X + Y + Z)
+#define FOO(X, Y) (X + Y + Z)
+
+#define BAR(X, Y, ...) (X + Y + Z)
+#define BAR(X, Y, ...) (X + Y + Z)
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0101-wcharlit.c
@@ -1,0 +1,5 @@
+int
+main()
+{
+ return L'\0';
+}
--- /dev/null
+++ b/tests/cc/execute/0102-bug.c
@@ -1,0 +1,14 @@
+// This wouldn't compile
+
+typedef struct { } Vec;
+
+static void
+vecresize(Vec *v, int cap)
+{
+ return;
+}
+
+int main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0103-voidparm.c
@@ -1,0 +1,11 @@
+int
+foo(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ return foo();
+}
--- /dev/null
+++ b/tests/cc/execute/0104-qbebug.c
@@ -1,0 +1,10 @@
+int
+main()
+{
+ int c;
+ c = 0;
+ do
+ ;
+ while (0);
+ return c;
+}
--- /dev/null
+++ b/tests/cc/execute/0105-shl.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int x;
+
+ x = 1;
+ if ((x << 1) != 2)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0106-ppcast.c
@@ -1,0 +1,14 @@
+int
+main()
+{
+ int x;
+ void *foo;
+ void **bar;
+
+ x = 0;
+
+ foo = (void*)&x;
+ bar = &foo;
+
+ return **(int**)bar;
+}
--- /dev/null
+++ b/tests/cc/execute/0107-bnot.c
@@ -1,0 +1,22 @@
+#include <stdint.h>
+
+int
+main()
+{
+ int32_t x;
+ int64_t l;
+
+ x = 0;
+ l = 0;
+
+ x = ~x;
+ if (x != 0xffffffff)
+ return 1;
+
+ l = ~l;
+ if (x != 0xffffffffffffffff)
+ return 2;
+
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0108-bug.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int i;
+
+ for(i = 0; i < 10; i++)
+ if (!i)
+ continue;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0109-struct.c
@@ -1,0 +1,10 @@
+struct S1 { int x; };
+struct S2 { struct S1 s1; };
+
+int
+main()
+{
+ struct S2 s2;
+ s2.s1.x = 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0110-typedefcast.c
@@ -1,0 +1,8 @@
+typedef int myint;
+myint x = (myint)1;
+
+int
+main(void)
+{
+ return x-1;
+}
--- /dev/null
+++ b/tests/cc/execute/0111-doubledef.c
@@ -1,0 +1,9 @@
+int foo(void);
+int foo(void);
+#define FOO 0
+
+int
+main()
+{
+ return FOO;
+}
--- /dev/null
+++ b/tests/cc/execute/0112-cond.c
@@ -1,0 +1,11 @@
+int
+main()
+{
+ int x = 0;
+ int y = 1;
+ if(x ? 1 : 0)
+ return 1;
+ if(y ? 0 : 1)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0113-externredecl.c
@@ -1,0 +1,8 @@
+extern int x;
+int x;
+
+int
+main()
+{
+ return x;
+}
--- /dev/null
+++ b/tests/cc/execute/0114-shortassig.c
@@ -1,0 +1,9 @@
+int
+main()
+{
+ short s = 1;
+ long l = 1;
+
+ s -= l;
+ return s;
+}
--- /dev/null
+++ b/tests/cc/execute/0115-null-comparision.c
@@ -1,0 +1,5 @@
+int
+main()
+{
+ return "abc" == (void *)0;
+}
--- /dev/null
+++ b/tests/cc/execute/0116-floatcmp.c
@@ -1,0 +1,8 @@
+int
+main()
+{
+ int a = 0;
+ float f = a + 1;
+
+ return f == a;
+}
--- /dev/null
+++ b/tests/cc/execute/0117-pointarith.c
@@ -1,0 +1,7 @@
+int
+main()
+{
+ int i, *p = &i;
+
+ return p - (void*) 0 == 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0118-voidmain.c
@@ -1,0 +1,7 @@
+int main(void);
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0119-macrostr.c
@@ -1,0 +1,17 @@
+#define B "b"
+
+char s[] = "a" B "c";
+
+int
+main()
+{
+ if (s[0] != 'a')
+ return 1;
+ if (s[1] != 'b')
+ return 2;
+ if (s[2] != 'c')
+ return 3;
+ if (s[3] != '\0')
+ return 4;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0120-funpar.c
@@ -1,0 +1,11 @@
+int
+f(int f)
+{
+ return f;
+}
+
+int
+main()
+{
+ return f(0);
+}
--- /dev/null
+++ b/tests/cc/execute/0121-localinit.c
@@ -1,0 +1,5 @@
+main()
+{
+ int x[] = { 1, 0 };
+ return x[1];
+}
--- /dev/null
+++ b/tests/cc/execute/0122-localinit.c
@@ -1,0 +1,6 @@
+int
+main()
+{
+ struct { int x; } s = { 0 };
+ return s.x;
+}
--- /dev/null
+++ b/tests/cc/execute/0123-doubleconst.c
@@ -1,0 +1,7 @@
+double x = 100;
+
+int
+main()
+{
+ return x < 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0124-enumstruct.c
@@ -1,0 +1,10 @@
+struct {
+ enum { X } x;
+} s;
+
+
+int
+main()
+{
+ return X;
+}
--- /dev/null
+++ b/tests/cc/execute/0125-fundcl.c
@@ -1,0 +1,20 @@
+int f(int a), g(int a), a;
+
+
+int
+main()
+{
+ return f(1) - g(1);
+}
+
+int
+f(int a)
+{
+ return a;
+}
+
+int
+g(int a)
+{
+ return a;
+}
--- /dev/null
+++ b/tests/cc/execute/0126-macropar.c
@@ -1,0 +1,6 @@
+#define F(a, b) a
+int
+main()
+{
+ return F(, 1) 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0127-doublecte.c
@@ -1,0 +1,7 @@
+double x = 100.0;
+
+int
+main()
+{
+ return x < 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0128-kr_names.c
@@ -1,0 +1,13 @@
+int f(a,b);
+
+int
+f(a,b,c) char b;
+{
+ return a - c + b;
+}
+
+int
+main(void)
+{
+ return f(1,0,1);
+}
--- /dev/null
+++ b/tests/cc/execute/0129-initi.c
@@ -1,0 +1,11 @@
+struct range {
+ long quant;
+} *a;
+long b;
+
+int
+main()
+{
+ struct range r = a[0];
+ b = r.quant;
+}
--- /dev/null
+++ b/tests/cc/execute/0130-mulpars.c
@@ -1,0 +1,22 @@
+int
+f2(int c, int b)
+{
+ return c - b;
+}
+
+int (*
+f1(int a, int b))(int c, int b)
+{
+ if (a != b)
+ return f2;
+ return 0;
+}
+
+int
+main()
+{
+ int (* (*p)(int a, int b))(int c, int d) = f1;
+
+
+ return (*(*p)(0, 2))(2, 2);
+}
--- /dev/null
+++ b/tests/cc/execute/0131-hello.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("hello world\n");
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0132-forward.c
@@ -1,0 +1,21 @@
+struct S *x;
+struct S {
+ int i;
+ struct S *next;
+};
+
+int
+main(void)
+{
+ struct S y, *p;
+ unsigned n;
+
+ y.i = 0;
+ y.next = 0;
+ x = &y;
+ *x = y;
+
+ for (n = 0, p = &y; p; ++n, p = p->next)
+ ;
+ return n;
+}
--- /dev/null
+++ b/tests/cc/execute/0133-ftn-ptr.c
@@ -1,0 +1,17 @@
+int
+foo(void)
+{
+ return 42;
+}
+
+int
+bar(void)
+{
+ return 24;
+}
+
+int
+main(void)
+{
+ return (1 ? foo : bar)();
+}
--- /dev/null
+++ b/tests/cc/execute/0134-arith.c
@@ -1,0 +1,36 @@
+int
+main()
+{
+ int x;
+
+ x = 0;
+ if ((x = x + 2) != 2) // 2
+ return 1;
+ if ((x = x - 1) != 1) // 1
+ return 1;
+ if ((x = x * 6) != 6) // 6
+ return 1;
+ if ((x = x / 2) != 3) // 3
+ return 1;
+ if ((x = x % 2) != 1) // 1
+ return 1;
+ if ((x = x << 2) != 4) // 4
+ return 1;
+ if ((x = x >> 1) != 2) // 2
+ return 1;
+ if ((x = x | 255) != 255) // 255
+ return 1;
+ if ((x = x & 3) != 3) // 3
+ return 1;
+ if ((x = x ^ 1) != 2) // 2
+ return 1;
+ if ((x = x + (x > 1)) != 2) // 2
+ return 1;
+ if ((x = x + (x < 3)) != 2) // 2
+ return 1;
+ if ((x = x + (x > 1)) != 3) // 3
+ return 1;
+ if ((x = x + (x < 4)) != 4) // 4
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0135-unary.c
@@ -1,0 +1,14 @@
+int
+main()
+{
+ int x;
+
+ x = 3;
+ x = !x; // 0
+ x = !x; // 1
+ x = ~x; // -1
+ x = -x; // 2
+ if(x != 2)
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0136-if.c
@@ -1,0 +1,21 @@
+int c;
+
+int
+main()
+{
+ if(0) {
+ return 1;
+ } else if(0) {
+ /* empty */
+ } else {
+ if(1) {
+ if(c)
+ return 1;
+ else
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ return 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0137-int-cast.c
@@ -1,0 +1,138 @@
+int a;
+unsigned b;
+char c;
+signed char d;
+unsigned char e;
+long f;
+unsigned long g;
+long long h;
+unsigned long long i;
+short j;
+unsigned short k;
+
+int
+main(void)
+{
+ a = b;
+ a = c;
+ a = d;
+ a = e;
+ a = f;
+ a = g;
+ a = h;
+ a = i;
+ a = j;
+ a = k;
+
+ b = a;
+ b = c;
+ b = d;
+ b = e;
+ b = f;
+ b = g;
+ b = h;
+ b = i;
+ b = j;
+ b = k;
+
+ c = a;
+ c = b;
+ c = d;
+ c = e;
+ c = f;
+ c = g;
+ c = h;
+ c = i;
+ c = j;
+ c = k;
+
+ d = a;
+ d = b;
+ d = c;
+ d = e;
+ d = f;
+ d = g;
+ d = h;
+ d = i;
+ d = j;
+ d = k;
+
+ e = a;
+ e = b;
+ e = c;
+ e = d;
+ e = f;
+ e = g;
+ e = h;
+ e = i;
+ e = j;
+ e = k;
+
+ f = a;
+ f = b;
+ f = c;
+ f = d;
+ f = e;
+ f = g;
+ f = h;
+ f = i;
+ f = j;
+ f = k;
+
+ g = a;
+ g = b;
+ g = c;
+ g = d;
+ g = e;
+ g = f;
+ g = h;
+ g = i;
+ g = j;
+ g = k;
+
+ h = a;
+ h = b;
+ h = c;
+ h = d;
+ h = e;
+ h = f;
+ h = g;
+ h = i;
+ h = j;
+ h = k;
+
+ i = a;
+ i = b;
+ i = c;
+ i = d;
+ i = e;
+ i = f;
+ i = g;
+ i = h;
+ i = j;
+ i = k;
+
+ j = a;
+ j = b;
+ j = c;
+ j = d;
+ j = e;
+ j = f;
+ j = g;
+ j = h;
+ j = i;
+ j = k;
+
+ k = a;
+ k = b;
+ k = c;
+ k = d;
+ k = e;
+ k = f;
+ k = g;
+ k = h;
+ k = j;
+ k = i;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0138-namespace.c
@@ -1,0 +1,30 @@
+typedef struct s s;
+
+struct s {
+ struct s1 {
+ int s;
+ struct s2 {
+ int s;
+ } s1;
+ } s;
+} s2;
+
+#define s s
+
+int
+main(void)
+{
+#undef s
+ goto s;
+ struct s s;
+ {
+ int s;
+ return s;
+ }
+ return s.s.s + s.s.s1.s;
+ s:
+ {
+ return 0;
+ }
+ return 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0139-ptr-ary.c
@@ -1,0 +1,22 @@
+int
+main()
+{
+ char arr[2][4], (*p)[4], *q;
+ int v[4];
+
+ p = arr;
+ q = &arr[1][3];
+ arr[1][3] = 2;
+ v[0] = 2;
+
+ if (arr[1][3] != 2)
+ return 1;
+ if (p[1][3] != 2)
+ return 1;
+ if (*q != 2)
+ return 1;
+ if (*v != 2)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0140-int-fold.c
@@ -1,0 +1,27 @@
+int
+main(void)
+{
+ int i;
+
+ i = 1 + 2;
+ i = 2 - 1;
+ i = 3 * 6;
+ i = 10 / 5;
+ i = 10 % 5;
+ i = i % 0;
+ i = i % 0;
+ i = 1 << 3;
+ i = 8 >> 2;
+ i = 12 & 4;
+ i = 8 | 4;
+ i = 12 ^ 4;
+ i = -(3);
+ i = ~12;
+ i = 1 < 3;
+ i = 2 > 3;
+ i = 2 >= 3;
+ i = 2 <= 3;
+ i = 1 == 0;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0141-int-iden.c
@@ -1,0 +1,45 @@
+int
+main(void)
+{
+ int i;
+
+ i = i || 0;
+ i = i || 4;
+ i = 4 || i;
+ i = 0 || i;
+ i = i && 0;
+ i = i && 4;
+ i = 4 && i;
+ i = 0 && i;
+ i = i << 0;
+ i = 0 << i;
+ i = i >> 0;
+ i = 0 >> i;
+ i = i + 0;
+ i = 0 + i;
+ i = i - 0;
+ i = 0 - i;
+ i = i | 0;
+ i = 0 | i;
+ i = i ^ 0;
+ i = 0 ^ i;
+ i = i * 0;
+ i = 0 * i;
+ i = i * 1;
+ i = 1 * i;
+ i = i / 1;
+
+ if (i)
+ i = 1 / i;
+
+ i = i & ~0;
+ i = ~0 & i;
+ i = i % 1;
+
+ if (0)
+ i = i / 0;
+ if (0)
+ i = i % 0;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0142-char-const.c
@@ -1,0 +1,40 @@
+int
+main(void)
+{
+ unsigned char uc;
+ signed char sc;
+
+ uc = -1;
+ if ((uc & 0xFF) != 0xFF)
+ return 1;
+
+ uc = '\x23';
+ if (uc != 36)
+ return 1;
+
+ uc = 1u;
+ if (uc != (1025 & 0xFF)
+ return 1;
+
+ uc = 'A';
+ if (uc != 0x41)
+ return 1;
+
+ sc = -1;
+ if ((sc & 0xFF) != 0xFF)
+ return 1;
+
+ sc = '\x23';
+ if (sc != 36)
+ return 1;
+
+ sc = 1u;
+ if (uc != (1025 & 0xFF)
+ return 1;
+
+ sc = 'A';
+ if (uc != 0x41)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0143-int-const.c
@@ -1,0 +1,24 @@
+main(void)
+{
+ int i;
+ unsigned u;
+
+ i = 1;
+ i = -1;
+ i = -1l;
+ i = -1u;
+ i = -1ll;
+ i = 32766 + 1 & 3;
+ i = (int) 32768 < 0;
+ i = -1u < 0;
+
+ u = 1;
+ u = -1;
+ u = -1l;
+ u = -1u;
+ u = -1ll;
+ u = (unsigned) 32768 < 0;
+ u = 32766 + 1 & 3;
+ u = -1u < 0;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0144-long-const.c
@@ -1,0 +1,25 @@
+int
+main(void)
+{
+ long i;
+ unsigned long u;
+
+ i = 1;
+ i = -1;
+ i = -1l;
+ i = -1u;
+ i = -1ll;
+ i = (1ll << 32) - 1 & 3;
+ i = (long) ((1ll << 32) - 1) < 0;
+ i = -1u < 0;
+
+ u = 1;
+ u = -1;
+ u = -1l;
+ u = -1u;
+ u = -1ll;
+ u = (1ll << 32) - 1 & 3;
+ u = (long) ((1ll << 32) - 1) < 0;
+ u = -1u < 0;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0145-llong-const.c
@@ -1,0 +1,23 @@
+int
+main(void)
+{
+ long long i;
+ unsigned long long u;
+
+ i = 1;
+ i = -1;
+ i = -1l;
+ i = -1u;
+ i = -1ll;
+ i = -1ll & 3;
+ i = -1ll < 0;
+
+ u = 1;
+ u = -1;
+ u = -1l;
+ u = -1u;
+ u = -1ll;
+ u = -1llu & 3;
+ u = -1llu < 0;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0146-ifdef.c
@@ -1,0 +1,52 @@
+#define FOO
+
+#ifdef FOO
+ int a;
+ int b;
+ #undef FOO
+ #ifndef FOO
+ int c;
+ int d;
+ #else
+ int e;
+ int f;
+ #endif
+ int e;
+ int f;
+ #ifdef FOO
+ int c_;
+ int d_;
+ #else
+ int e_;
+ int f_;
+ #endif
+ int e_;
+ int f_;
+int
+main()
+{
+ return 0;
+}
+#else
+ int j;
+ int k;
+ #ifdef FOO
+ int j;
+ int k;
+ #else
+ int n;
+ int o;
+ #endif
+ int n;
+ int o;
+ #ifndef FOO
+ int r;
+ int s;
+ #else
+ int t;
+ int u;
+ #endif
+ int t;
+ int u;
+ #error bad branch
+#endif
--- /dev/null
+++ b/tests/cc/execute/0147-intern-cpp.c
@@ -1,0 +1,19 @@
+#define x(y) (y)
+
+int
+main(void)
+{
+ int y;
+ char *p;
+
+ p = __FILE__;
+ y = __LINE__;
+ p = __DATE__;
+ y = __STDC__;
+ p = __TIME__;
+ y = __STDC_HOSTED__;
+ y = __SCC__;
+ y = x(1);
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0148-cpp-string.c
@@ -1,0 +1,10 @@
+#define x(y) #y
+
+int
+main(void)
+{
+ char *p;
+ p = x(hello) " is better than bye";
+
+ return (*p == 'h') ? 0 : 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0149-define.c
@@ -1,0 +1,10 @@
+#define M(x) x
+#define A(a,b) a(b)
+
+int
+main(void)
+{
+ char *a = A(M,"hi");
+
+ return (a[1] == 'i') ? 0 : 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0150-define.c
@@ -1,0 +1,15 @@
+/*
+ * f(2) will expand to 2*g, which will expand to 2*f, and in this
+ * moment f will not be expanded because the macro definition is
+ * a function alike macro, and in this case there is no arguments.
+ */
+#define f(a) a*g
+#define g f
+
+int
+main(void)
+{
+ int f = 0;
+
+ return f(2);
+}
--- /dev/null
+++ b/tests/cc/execute/0151-vararg.c
@@ -1,0 +1,25 @@
+struct foo {
+ int i, j, k;
+ char *p;
+ float v;
+};
+
+int
+f1(struct foo f, struct foo *p, int n, ...)
+{
+ if (f.i != p->i)
+ return 0;
+ return p->j + n;
+}
+
+int
+main(void)
+{
+ struct foo f;
+
+ f.i = f.j = 1;
+ f1(f, &f, 2);
+ f1(f, &f, 2, 1, f, &f);
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0152-cat.c
@@ -1,0 +1,14 @@
+#define CAT(x,y) x ## y
+#define XCAT(x,y) CAT(x,y)
+#define FOO foo
+#define BAR bar
+
+int
+main(void)
+{
+ int foo, bar, foobar;
+
+ CAT(foo,bar) = foo + bar;
+ XCAT(FOO,BAR) = foo + bar;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0153-cpp-string.c
@@ -1,0 +1,13 @@
+#define M1(x) "This is a string $ or # or ## " ## #x
+#define STR "This is a string $ or # or ## and it is ok!"
+
+int
+main(void)
+{
+ char *s, *t = M1(and it is ok!);
+
+ for (s = STR; *s && *s == *t; ++s)
+ ++t;
+
+ return *s;
+}
--- /dev/null
+++ b/tests/cc/execute/0154-if-defined.c
@@ -1,0 +1,15 @@
+#if defined(FOO)
+int a;
+#elif !defined(FOO) && defined(BAR)
+int b;
+#elif !defined(FOO) && !defined(BAR)
+int c;
+#else
+int d;
+#endif
+
+int
+main(void)
+{
+ return c;
+}
--- /dev/null
+++ b/tests/cc/execute/0155-struct-compl.c
@@ -1,0 +1,16 @@
+extern struct X x;
+int foo();
+
+int main()
+{
+ extern struct X x;
+ return &x != 0;
+}
+
+struct X {int v;};
+
+int foo()
+{
+ x.v = 0;
+ return x.v;
+}
--- /dev/null
+++ b/tests/cc/execute/0156-duff2.c
@@ -1,0 +1,35 @@
+/*
+ * Disgusting, no? But it compiles and runs just fine. I feel a
+ * combination of pride and revulsion at this discovery. If no one's
+ * thought of it before, I think I'll name it after myself. It amazes
+ * me that after 10 years of writing C there are still little corners
+ * that I haven't explored fully.
+ * - Tom Duff
+ */
+send(to, from, count)
+ register short *to, *from;
+ register count;
+{
+ register n=(count+7)/8;
+ switch(count%8){
+ case 0: do{*to = *from++;
+ case 7: *to = *from++;
+ case 6: *to = *from++;
+ case 5: *to = *from++;
+ case 4: *to = *from++;
+ case 3: *to = *from++;
+ case 2: *to = *from++;
+ case 1: *to = *from++;
+ }while(--n>0);
+ }
+}
+
+int
+main()
+{
+ short a, b[40];
+
+ send(&a, b, 40);
+
+ return (a == b[39]) ? 0 : 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0157-list.c
@@ -1,0 +1,14 @@
+typedef struct List List;
+struct List {
+ int len;
+ struct List *head;
+ List *back;
+};
+
+int
+main(void)
+{
+ List List;
+
+ return List.len;
+}
--- /dev/null
+++ b/tests/cc/execute/0158-ternary.c
@@ -1,0 +1,17 @@
+int
+main(void)
+{
+ int i, *q;
+ void *p;
+
+ i = i ? 0 : 0l;
+ p = i ? (void *) 0 : 0;
+ p = i ? 0 : (void *) 0;
+ p = i ? 0 : (const void *) 0;
+ q = i ? 0 : p;
+ q = i ? p : 0;
+ q = i ? q : 0;
+ q = i ? 0 : q;
+
+ return (int) q;
+}
--- /dev/null
+++ b/tests/cc/execute/0159-typedef.c
@@ -1,0 +1,24 @@
+/* Taken from plan9 kernel */
+
+typedef struct Clock0link Clock0link;
+typedef struct Clock0link {
+ int (*clock)(void);
+ Clock0link* link;
+} Clock0link;
+
+
+int
+f(void)
+{
+ return 0;
+}
+
+Clock0link cl0 = {
+ .clock = f;
+};
+
+int
+main(void)
+{
+ return (*cl0.clock)();
+}
--- /dev/null
+++ b/tests/cc/execute/0160-cpp-if.c
@@ -1,0 +1,17 @@
+#if 0 != (0 && (0/0))
+ #error 0 != (0 && (0/0))
+#endif
+
+#if 1 != (-1 || (0/0))
+ #error 1 != (-1 || (0/0))
+#endif
+
+#if 3 != (-1 ? 3 : (0/0))
+ #error 3 != (-1 ? 3 : (0/0))
+#endif
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0161-struct.c
@@ -1,0 +1,12 @@
+struct S { int a; int b; };
+struct S s = (struct S){1, 2};
+
+int
+main()
+{
+ if(s.a != 1)
+ return 1;
+ if(s.b != 2)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0162-array.c
@@ -1,0 +1,13 @@
+int arr[3] = {[2] = 2, [0] = 0, [1] = 1};
+
+int
+main()
+{
+ if(arr[0] != 0)
+ return 1;
+ if(arr[1] != 1)
+ return 2;
+ if(arr[2] != 2)
+ return 3;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0163-array.c
@@ -1,0 +1,16 @@
+struct S {int a; int b;};
+struct S arr[2] = {[1] = {3, 4}, [0] = {1, 2}};
+
+int
+main()
+{
+ if(arr[0].a != 1)
+ return 1;
+ if(arr[0].b != 2)
+ return 2;
+ if(arr[1].a != 3)
+ return 3;
+ if(arr[1].b != 4)
+ return 4;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0164-struct.c
@@ -1,0 +1,12 @@
+struct S { int a; int b; };
+struct S *s = &(struct S) { 1, 2 };
+
+int
+main()
+{
+ if(s->a != 1)
+ return 1;
+ if(s->b != 2)
+ return 2;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0165-struct.c
@@ -1,0 +1,33 @@
+struct S1 {
+ int a;
+ int b;
+};
+struct S2 {
+ struct S1 s1;
+ struct S1 *ps1;
+ int arr[2];
+};
+struct S1 gs1 = (struct S1) {.a = 1, 2};
+struct S2 *s = &(struct S2) {
+ {.b = 2, .a = 1},
+ &gs1,
+ {[0] = 1, 1+1}
+};
+
+int
+main()
+{
+ if(s->s1.a != 1)
+ return 1;
+ if(s->s1.b != 2)
+ return 2;
+ if(s->ps1->a != 1)
+ return 3;
+ if(s->ps1->b != 2)
+ return 4;
+ if(s->arr[0] != 1)
+ return 5;
+ if(s->arr[1] != 2)
+ return 6;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0166-desig.c
@@ -1,0 +1,18 @@
+struct S {
+ int a, b, c;
+ char d[3];
+ int e;
+} s = {
+ .a = 1,
+ .b = 2,
+ .d = {[0] = 3, [2] = 5},
+ .d = {[0] = 4, [1] = 6}
+};
+
+char m[] = {};
+
+int
+main(void)
+{
+ return sizeof(m) == s.d[2];
+}
--- /dev/null
+++ b/tests/cc/execute/0167-array.c
@@ -1,0 +1,15 @@
+int arr1[][3] = {
+ { 2, 7, 5, },
+ { 5, 1, 2, },
+};
+
+int arr2[2][3] = {
+ 2, 7, 5,
+ 5, 1, 2
+};
+
+int
+main(void)
+{
+ return !(arr1[1][2] == arr2[1][3]);
+}
--- /dev/null
+++ b/tests/cc/execute/0168-array.c
@@ -1,0 +1,16 @@
+int arr[][3][5] = {
+ {
+ { 0, 0, 3, 5 },
+ { 1, [3] = 6, 7 },
+ },
+ {
+ { 1, 2 },
+ { [4] = 7, },
+ },
+};
+
+int
+main(void)
+{
+ return !(arr[0][1][4] == arr[1][1][4]);
+}
--- /dev/null
+++ b/tests/cc/execute/0169-string.c
@@ -1,0 +1,27 @@
+char s0[] = "foo";
+char s1[7] = "foo";
+char s2[2] = "foo";
+char s3[] = {"foo"};
+char *p = "foo";
+
+int
+cmp(char *s1, char *s2)
+{
+ while (*s1 && *s1++ != *s2++)
+ ;
+ return *s1;
+}
+
+int
+main()
+{
+ if (sizeof(s0) != 4 || cmp(s0, "foo"))
+ return 1;
+ if (cmp(s1, "foo"))
+ return 1;
+ if (s2[0] != 'f' || s2[1] != 'o')
+ return 1;
+ if (sizeof(s3) != 4 || cmp(s3, "foo"))
+ return 1;
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0170-line.c
@@ -1,0 +1,13 @@
+#undef line
+#define line 1000
+
+#line line
+#if 1000 != __LINE__
+ #error " # line line" not work as expected
+#endif
+
+int
+main()
+{
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0171-macros.c
@@ -1,0 +1,10 @@
+#define X (2)
+#define L (0)
+#define H (1)
+#define Q(x) x
+
+int
+main(void)
+{
+ return X == L + H + Q(1);
+}
--- /dev/null
+++ b/tests/cc/execute/0172-hexa.c
@@ -1,0 +1,13 @@
+int
+main(void)
+{
+ if (0xa != 0xA ||
+ 0xb != 0xB ||
+ 0xc != 0xC ||
+ 0xd != 0xD ||
+ 0xe != 0xE ||
+ 0xf != 0xF) {
+ return 1;
+ }
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0173-macro.c
@@ -1,0 +1,13 @@
+#define x f
+#define y() f
+
+typedef struct { int f; } S;
+
+int
+main()
+{
+ S s;
+
+ s.x = 0;
+ return s.y();
+}
--- /dev/null
+++ b/tests/cc/execute/0174-decay.c
@@ -1,0 +1,24 @@
+int
+main(int argc, char *argv[])
+{
+ int v[1];
+ int (*p)[];
+ int (*f1)(int ,char *[]);
+ int (*f2)(int ,char *[]);
+
+ v[0] = 0;
+ p = &v;
+ f1 = &main;
+ f2 = main;
+ if (argc == 0)
+ return 1;
+ if ((****main)(0, 0))
+ return 2;
+ if ((****f1)(0, 0))
+ return 3;
+ if ((****f2)(0, 0))
+ return 4;
+ if (!(*p)[0])
+ return 0;
+ return 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0175-defined.c
@@ -1,0 +1,32 @@
+#if defined X
+X
+#endif
+
+#if defined(X)
+X
+#endif
+
+#if X
+X
+#endif
+
+#define X 0
+
+#if X
+X
+#endif
+
+#if defined(X)
+int x = 0;
+#endif
+
+#undef X
+#define X 1
+
+#if X
+int
+main()
+{
+ return 0;
+}
+#endif
--- /dev/null
+++ b/tests/cc/execute/0176-macro.c
@@ -1,0 +1,21 @@
+#ifdef __STDC__
+#define __(proto) proto
+#else
+#define __(proto) ()
+#endif
+
+extern int func __((int, int));
+
+int
+main()
+{
+ int (*fun)(int,int) = func;
+
+ return (*func)(1, 2);
+}
+
+int
+func(int a, int b)
+{
+ return a - b - 1;
+}
--- /dev/null
+++ b/tests/cc/execute/0177-literal.c
@@ -1,0 +1,9 @@
+void boo(int *p)
+{
+ return (*p[1] == 2) ? 0 : 1;
+}
+
+int main()
+{
+ return boo((int[]) {0, 2});
+}
--- /dev/null
+++ b/tests/cc/execute/0178-include.c
@@ -1,0 +1,8 @@
+#define FILE "0178-include.h"
+#include FILE
+
+int
+main()
+{
+ return RET;
+}
--- /dev/null
+++ b/tests/cc/execute/0178-include.h
@@ -1,0 +1,1 @@
+#define RET 0
--- /dev/null
+++ b/tests/cc/execute/0179-sizeof.c
@@ -1,0 +1,6 @@
+int
+main(void)
+{
+ sizeof((int) 1);
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0180-incomplete.c
@@ -1,0 +1,13 @@
+struct dummy;
+
+void *
+fun(struct dummy p[])
+{
+ return p;
+}
+
+int
+main()
+{
+ return fun(0) != 0;
+}
--- /dev/null
+++ b/tests/cc/execute/0181-stringize.c
@@ -1,0 +1,16 @@
+#define XSTR(x) #x
+#define STR(x) XSTR(x)
+#define S y = "str"
+
+int
+main()
+{
+ char *s, *t = STR(S);
+
+ for (s = "y = \"str\""; *s && *t; ++s, ++t) {
+ if (*s != *t)
+ return 1;
+ }
+
+ return 0;
+}
--- /dev/null
+++ b/tests/cc/execute/Makefile
@@ -1,0 +1,12 @@
+.POSIX:
+
+ROOT=../../..
+
+all: tests
+
+tests:
+ @CFLAGS='' SCCPREFIX=$(ROOT) PATH=$(ROOT)/bin:$$PATH ./chktest.sh scc-tests.lst
+
+clean:
+ rm -f *.as *.o *.ir *.qbe *core test.log
+
--- /dev/null
+++ b/tests/cc/execute/README
@@ -1,0 +1,2 @@
+These tests are taken from https://github.com/andrewchambers/qc.
+All the credits for this test suite are for Andrew Chambers.
--- /dev/null
+++ b/tests/cc/execute/chktest.sh
@@ -1,0 +1,24 @@
+#!/bin/sh
+
+file=${1?' empty input file'}
+trap "rm -f a.out; exit" 0 1 2 3 15
+ulimit -c 0
+rm -f test.log
+
+SYS=`uname | tr A-Z a-z`
+FORMAT=elf
+ABI=sysv
+ARCH=amd64
+
+export SYS FORMAT ABI ARCH
+
+while read i state
+do
+ echo $i >>test.log
+ state=${state:-""}
+ rm -f a.out
+
+ (scc -Isysinclude $CFLAGS "$i" && ./a.out) 2>>test.log &&
+ printf '[PASS]' || printf '[FAIL]'
+ printf '\t%s\t%s\n' $i $state
+done < $file
--- /dev/null
+++ b/tests/cc/execute/compose.sh
@@ -1,0 +1,23 @@
+#!/bin/sh
+
+rm -f tmp_test.c
+rm -f tests.h
+rm -f tmp_*.c
+
+(echo '#include "tests.h"'
+echo 'int main()'
+echo '{'
+
+for i in *-*.c
+do
+ n=`echo $i | sed 's/\(.*\)-.*\.c/\1/'`
+ sed s/main/main_$n/ < $i > tmp_$n.c
+ echo "int main_$n();" >> tests.h
+ echo "main_$n();"
+
+done
+
+echo 'return 0;'
+echo '}'
+) > tmp_test.c
+
--- /dev/null
+++ b/tests/cc/execute/include/0062-include.h
@@ -1,0 +1,5 @@
+#include "0062-include2.h"
+
+int
+main()
+{
--- /dev/null
+++ b/tests/cc/execute/include/0062-include2.h
@@ -1,0 +1,2 @@
+int x;
+
--- /dev/null
+++ b/tests/cc/execute/scc-tests.lst
@@ -1,0 +1,174 @@
+0001-sanity.c
+0002-expr.c
+0003-local.c
+0004-pointer.c
+0005-ifstmt.c
+0006-whilestmt.c
+0007-forstmt.c
+0008-dowhilestmt.c
+0009-expr.c
+0010-goto.c
+0011-assign.c
+0012-expr.c
+0013-addridx.c
+0014-assignidx.c
+0015-localarray.c
+0016-addrarray.c
+0017-struct.c
+0018-structptr.c
+0019-selfrefstruct.c
+0020-ptrptr.c
+0021-intfunc.c
+0022-typedef.c
+0023-global.c
+0024-typedefstruct.c
+0025-string.c
+0026-implicitret.c
+0027-charval.c
+0028-bor.c
+0029-band.c
+0030-bxor.c
+0031-relop.c
+0032-indec.c
+0033-ptrindec.c
+0034-logandor.c
+0035-breakcont.c
+0036-notneg.c
+0037-assignop.c
+0038-ptradd.c
+0039-sizeof.c
+0040-cast.c
+0041-queen.c
+0042-prime.c
+0043-union.c
+0044-struct.c
+0045-struct.c
+0046-inits.c
+0048-inits.c
+0049-inits.c
+0050-inits.c
+0052-switch.c
+0053-struct.c
+0054-struct.c
+0055-enum.c
+0056-enum.c
+0057-duff.c
+0058-bug.c
+0059-multistring.c
+0060-charlit.c
+0061-comments.c
+0062-include.c
+0063-define.c
+0064-sysinclude.c
+0065-ifdef.c
+0066-cppelse.c
+0067-define.c
+0068-funclikemacro.c
+0069-funclikemacro.c
+0070-cppif.c
+0071-cppelif.c
+0072-cppelif.c
+0073-ifndef.c
+0074-undef.c
+0075-ptraddasn.c
+0076-ptrsubasn.c
+0077-defined.c
+0078-dirifexpr.c
+0079-cond.c
+0080-arrays.c
+0081-calls.c
+0082-bug.c
+0083-voidret.c
+0084-longlong.c
+0085-ulonglong.c
+0089-short.c
+0090-fptr.c
+0091-fptr.c
+0092-fptr.c
+0093-arrayinit.c
+0094-arrayinit.c [TODO]
+0095-arrayselector.c
+0096-inferredarraysize.c
+0097-extern.c
+0098-tentative.c [TODO]
+0099-tentative.c [TODO]
+0102-bug.c
+0103-voidparm.c
+0104-qbebug.c
+0105-shl.c
+0106-ppcast.c
+0107-bnot.c
+0108-bug.c
+0109-struct.c
+0110-typedefcast.c
+0111-doubledef.c
+0112-cond.c
+0113-externredecl.c
+0114-shortassig.c [TODO]
+0115-null-comparision.c
+0116-floatcmp.c [TODO]
+0117-pointarith.c
+0118-voidmain.c [TODO]
+0119-macrostr.c
+0120-funpar.c
+0121-localinit.c [TODO]
+0122-localinit.c [TODO]
+0123-doubleconst.c [TODO]
+0124-enumstruct.c [TODO]
+0125-fundcl.c
+0126-macropar.c [TODO]
+0127-doublecte.c [TODO]
+0128-kr_names.c
+0129-initi.c [TODO]
+0130-mulpars.c
+0131-hello.c [TODO]
+0132-forward.c [TODO]
+0133-ftn-ptr.c [TODO]
+0134-arith.c [TODO]
+0135-unary.c
+0136-if.c
+0137-int-cast.c [TODO]
+0138-namespace.c
+0139-ptr-ary.c [TODO]
+0140-int-fold.c [TODO]
+0141-int-iden.c [TODO]
+0142-char-const.c [TODO]
+0143-int-const.c
+0144-long-const.c
+0145-llong-const.c [TODO]
+0146-ifdef.c
+0147-intern-cpp.c
+0148-cpp-string.c
+0149-define.c
+0150-define.c
+0151-vararg.c [TODO]
+0152-cat.c
+0153-cpp-string.c [TODO]
+0154-if-defined [TODO]
+0155-struct-compl.c [TODO]
+0156-duff2.c [TODO]
+0157-list.c [TODO]
+0158-ternary.c [TODO]
+0159-typedef.c [TODO]
+0160-cpp-if.c [TODO]
+0161-struct.c [TODO]
+0162-array.c
+0163-array.c [TODO]
+0164-struct.c [TODO]
+0165-struct.c [TODO]
+0166-desig.c [TODO]
+0167-array.c [TODO]
+0168-array.c [TODO]
+0169-string.c [TODO]
+0170-line.c [TODO]
+0171-macros.c [TODO]
+0172-hexa.c
+0173-macro.c
+0174-decay.c [TODO]
+0175-defined.c
+0176-macro.c [TODO]
+0177-literal.c [TODO]
+0178-include.c [TODO]
+0179-sizeof.c [TODO]
+0180-incomplete.c
+0181-stringize.c [TODO]
--- /dev/null
+++ b/tests/cc/execute/sysinclude/0064-sysinclude.h
@@ -1,0 +1,4 @@
+#include "0064-sysinclude2.h"
+
+int x = 2;
+
--- /dev/null
+++ b/tests/cc/execute/sysinclude/0064-sysinclude2.h
@@ -1,0 +1,1 @@
+int y = 2;
--- a/tests/scc/error/0001-sanity.c
+++ /dev/null
@@ -1,11 +1,0 @@
-/*
-PATTERN:
-0001-sanity.c:9: error: 'FOO' undeclared
-.
-*/
-
-int main()
-{
- return FOO;
-}
-
--- a/tests/scc/error/0002-missinginclude.c
+++ /dev/null
@@ -1,7 +1,0 @@
-/*
-PATTERN:
-0002-missinginclude.c:7: error: included file 'MISSING.h' not found
-.
-*/
-
-#include "MISSING.h"
--- a/tests/scc/error/0003-junkinclude.c
+++ /dev/null
@@ -1,7 +1,0 @@
-/*
-PATTERN:
-0003-junkinclude.c:7: error: trailing characters after preprocessor directive
-.
-*/
-
-#include "0003-junkinclude.c" bar
--- a/tests/scc/error/0004-macroredef.c
+++ /dev/null
@@ -1,9 +1,0 @@
-/*
-PATTERN:
-0004-macroredef.c:8: warning: 'X' redefined
-.
-*/
-
-#define X 1
-#define X 2
-
--- a/tests/scc/error/0005-fmacro.c
+++ /dev/null
@@ -1,8 +1,0 @@
-/*
-PATTERN:
-0005-fmacro.c:7: error: macro arguments must be identifiers
-.
-*/
-
-#define X(
-
--- a/tests/scc/error/0006-endif.c
+++ /dev/null
@@ -1,8 +1,0 @@
-/*
-PATTERN:
-0006-endif.c:7: error: #endif without #if
-.
-*/
-
-#endif
-
--- a/tests/scc/error/0007-unmatchedcppif.c
+++ /dev/null
@@ -1,9 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-#ifdef FOO
-
-
--- a/tests/scc/error/0008-unmatchedcppelse.c
+++ /dev/null
@@ -1,9 +1,0 @@
-/*
-PATTERN:
-0008-unmatchedcppelse.c:7: error: #else without #ifdef/ifndef
-.
-*/
-
-#else
-
-
--- a/tests/scc/error/0009-unmatchedcppelif.c
+++ /dev/null
@@ -1,8 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-#elif 1
-
--- a/tests/scc/error/0010-extraelif.c
+++ /dev/null
@@ -1,13 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-#if 1
-
-#else
-
-#elif 0
-
-#endif
--- a/tests/scc/error/0011-extraelse.c
+++ /dev/null
@@ -1,13 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-#if 1
-
-#else
-
-#else
-
-#endif
--- a/tests/scc/error/0012-ifnoexpr.c
+++ /dev/null
@@ -1,10 +1,0 @@
-/*
-PATTERN:
-0012-ifnoexpr.c:7: error: unexpected '
-'
-.
-*/
-
-#if
-#endif
-
--- a/tests/scc/error/0013-macro.c
+++ /dev/null
@@ -1,10 +1,0 @@
-/*
-PATTERN:
-0013-macro.c:9: error: macro "X" received 0 arguments, but it takes 1
-.
-*/
-
-#define X(A, ...) 0
-
-X()
-
--- a/tests/scc/error/0014-macro.c
+++ /dev/null
@@ -1,10 +1,0 @@
-/*
-PATTERN:
-0014-macro.c:9: error: macro "X" received 1 arguments, but it takes 0
-.
-*/
-
-#define X() 0
-
-X(A)
-
--- a/tests/scc/error/0015-macro.c
+++ /dev/null
@@ -1,8 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-#define X(A, A) 0
-
--- a/tests/scc/error/0016-arrayinitsize.c
+++ /dev/null
@@ -1,7 +1,0 @@
-/*
-PATTERN:
-
-.
-*/
-
-int x[2] = {1, 2, 3};
--- a/tests/scc/error/0017-duplicatefunc.c
+++ /dev/null
@@ -1,18 +1,0 @@
-/*
-PATTERN:
-0017-duplicatefunc.c:15: error: redefinition of 'main'
-.
-*/
-
-int
-main()
-{
- return 0;
-}
-
-int
-main()
-{
- return 0;
-}
-
--- a/tests/scc/error/0018-voidparam.c
+++ /dev/null
@@ -1,36 +1,0 @@
-/*
-PATTERN:
-0018-voidparam.c:27: error: a named argument is requiered before '...'
-.
-*/
-
-
-int
-a(void, int i)
-{
- return 0;
-}
-
-int
-b(int i, void)
-{
- return 0;
-}
-
-int
-c(void, void)
-{
- return 0;
-}
-
-int
-d(void, ...)
-{
- return 0;
-}
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/error/0019-kr_names.c
+++ /dev/null
@@ -1,21 +1,0 @@
-/*
-PATTERN:
-0019-kr_names.c:9: warning: parameter names (without types) in function declaration
-0019-kr_names.c:13: warning: type of 'a' defaults to int
-0019-kr_names.c:13: warning: type of 'c' defaults to int
-.
-*/
-
-int f(a,b);
-
-int
-f(a,b,c) char b;
-{
- return a - c + b;
-}
-
-int
-main(void)
-{
- return f(1,0,1);
-}
--- a/tests/scc/error/0020-storage.c
+++ /dev/null
@@ -1,37 +1,0 @@
-int a;
-static char b;
-extern int c;
-typedef unsigned e;
-
-int
-func1(void)
-{
- auto h;
- static char i;
- register long j;
- extern int k;
- static unsigned long a;
- return 0;
-}
-
-void
-func2(register int par)
-{
- int par;
-}
-
-static void
-func3(register int par)
-{
-}
-
-register short d;
-
-register void
-func4(static int par)
-{
- static register f;
-}
-
-short d;
-char d;
--- a/tests/scc/error/0021-namespace.c
+++ /dev/null
@@ -1,29 +1,0 @@
-typedef struct s s;
-
-struct s {
- struct s1 {
- int s;
- struct s2 {
- int s;
- } s1;
- } s;
-} s2;
-
-#define s s
-
-int
-main(void)
-{
-#undef s
- goto s;
- struct s s;
- {
- int s;
- return s;
- }
- return s.s.s + s.s.s1.s;
- s:
- {
- s: return 0;
- }
-}
--- a/tests/scc/error/0021-void.c
+++ /dev/null
@@ -1,7 +1,0 @@
-int
-main(void)
-{
- void f(void);
-
- return (int) f();
-}
--- a/tests/scc/error/0022-cpp-if.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#if 3 != (1,2,3)
- #error 3 != (1,2,3)
-#endif
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/error/0023-include.c
+++ /dev/null
@@ -1,6 +1,0 @@
-/*
- * Test a comment that goes beyond of the end of an
- * included file
- */
-
-#include "0023-include.h"
--- a/tests/scc/error/0023-include.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef TEST_H_
-#define TEST_H_
-
-/*
- This is an unterminated comment.
-
-
-#endif
--- a/tests/scc/error/Makefile
+++ /dev/null
@@ -1,11 +1,0 @@
-.POSIX:
-
-ROOT=../../../root
-
-all: tests
-
-tests:
- @CFLAGS='' SCCPREFIX=$(ROOT) PATH=$(ROOT)/bin:$$PATH chktest.sh scc-tests.lst
-
-clean:
- rm -f *.as *.o *.ir *.qbe *core test.log
--- a/tests/scc/error/README
+++ /dev/null
@@ -1,2 +1,0 @@
-These tests are taken from https://github.com/andrewchambers/qc.
-All the credits for this test suite are for Andrew Chambers.
--- a/tests/scc/error/chktest.sh
+++ /dev/null
@@ -1,21 +1,0 @@
-#!/bin/sh
-
-file=${1?' empty input file'}
-err=/tmp/$$.err
-chk=/tmp/$$.chk
-
-trap "rm -f a.out *.o $chk $err; exit" 0 1 2 3 15
-ulimit -c 0
-rm -f test.log
-
-while read i state
-do
- echo $i >> test.log
- state=${state:-"\t"}
-
- scc $CFLAGS -w -c $i 2> $err
- echo "/^PATTERN/+;/^\./-w $chk" | ed -s $i
- diff -c $chk $err >> test.log && printf '[PASS]' || echo '[FAIL]'
- printf "%s\t%s\n" "$state" "$i"
- rm -f *.o
-done < $file
--- a/tests/scc/error/scc-tests.lst
+++ /dev/null
@@ -1,23 +1,0 @@
-0001-sanity.c
-0002-missinginclude.c
-0003-junkinclude.c
-0004-macroredef.c
-0005-fmacro.c
-0006-endif.c
-0007-unmatchedcppif.c [TODO]
-0008-unmatchedcppelse.c
-0009-unmatchedcppelif.c [TODO]
-0010-extraelif.c [TODO]
-0011-extraelse.c [TODO]
-0012-ifnoexpr.c [TODO]
-0013-macro.c
-0014-macro.c
-0015-macro.c [TODO]
-0016-arrayinitsize.c [TODO]
-0017-duplicatefunc.c
-0018-voidparam.c [TODO]
-0019-kr_names.c
-0020-storage.c [TODO]
-0021-void.c [TODO]
-0022-cpp-if.c [TODO]
-0023-include.c [TODO]
--- a/tests/scc/error/update.sh
+++ /dev/null
@@ -1,10 +1,0 @@
-#!/bin/sh
-
-for i
-do
- (echo '/^PATTERN/+;/^\./-c'
- scc $CFLAGS -w -c $i 2>&1
- printf ".\nw\n"
- echo w) |
- ed -s $i
-done
--- a/tests/scc/execute/0001-sanity.c
+++ /dev/null
@@ -1,5 +1,0 @@
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0002-expr.c
+++ /dev/null
@@ -1,5 +1,0 @@
-int
-main()
-{
- return 3-3;
-}
--- a/tests/scc/execute/0003-local.c
+++ /dev/null
@@ -1,8 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 4;
- return x - 4;
-}
--- a/tests/scc/execute/0004-pointer.c
+++ /dev/null
@@ -1,12 +1,0 @@
-int
-main()
-{
- int x;
- int *p;
-
- x = 4;
- p = &x;
- *p = 0;
-
- return *p;
-}
--- a/tests/scc/execute/0005-ifstmt.c
+++ /dev/null
@@ -1,23 +1,0 @@
-int
-main()
-{
- int x;
- int *p;
- int **pp;
-
- x = 0;
- p = &x;
- pp = &p;
-
- if(*p)
- return 1;
- if(**pp)
- return 1;
- else
- **pp = 1;
-
- if(x)
- return 0;
- else
- return 1;
-}
--- a/tests/scc/execute/0006-whilestmt.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 50;
- while (x)
- x = x - 1;
- return x;
-}
--- a/tests/scc/execute/0007-forstmt.c
+++ /dev/null
@@ -1,15 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- for(x = 10; x; x = x - 1)
- ;
- if(x)
- return 1;
- x = 10;
- for (;x;)
- x = x - 1;
- return x;
-}
--- a/tests/scc/execute/0008-dowhilestmt.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 50;
- do
- x = x - 1;
- while(x);
- return x;
-}
--- a/tests/scc/execute/0009-expr.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- x = x * 10;
- x = x / 2;
- x = x % 3;
- return x - 2;
-}
--- a/tests/scc/execute/0010-goto.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int
-main()
-{
- start:
- goto next;
- return 1;
- success:
- return 0;
- next:
- foo:
- goto success;
- return 1;
-}
--- a/tests/scc/execute/0011-assign.c
+++ /dev/null
@@ -1,8 +1,0 @@
-int
-main()
-{
- int x;
- int y;
- x = y = 0;
- return x;
-}
--- a/tests/scc/execute/0012-expr.c
+++ /dev/null
@@ -1,5 +1,0 @@
-int
-main()
-{
- return (2 + 2) * 2 - 8;
-}
--- a/tests/scc/execute/0013-addridx.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x;
- int *p;
-
- x = 0;
- p = &x;
- return p[0];
-}
--- a/tests/scc/execute/0014-assignidx.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int x;
- int *p;
-
- x = 1;
- p = &x;
- p[0] = 0;
- return x;
-}
--- a/tests/scc/execute/0015-localarray.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int arr[2];
-
- arr[0] = 1;
- arr[1] = 2;
-
- return arr[0] + arr[1] - 3;
-}
--- a/tests/scc/execute/0016-addrarray.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[1];
- *p = 0;
- return arr[1];
-}
--- a/tests/scc/execute/0017-struct.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int
-main()
-{
- struct { int x; int y; } s;
-
- s.x = 3;
- s.y = 5;
- return s.y - s.x - 2;
-}
--- a/tests/scc/execute/0018-structptr.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int
-main()
-{
-
- struct S { int x; int y; } s;
- struct S *p;
-
- p = &s;
- s.x = 1;
- p->y = 2;
- return p->y + p->x - 3;
-}
-
--- a/tests/scc/execute/0019-selfrefstruct.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- struct S { struct S *p; int x; } s;
-
- s.x = 0;
- s.p = &s;
- return s.p->p->p->p->p->x;
-}
-
--- a/tests/scc/execute/0020-ptrptr.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x, *p, **pp;
-
- x = 0;
- p = &x;
- pp = &p;
- return **pp;
-}
--- a/tests/scc/execute/0021-intfunc.c
+++ /dev/null
@@ -1,12 +1,0 @@
-int
-foo(int a, int b)
-{
- return 2 + a - b;
-}
-
-int
-main()
-{
- return foo(1, 3);
-}
-
--- a/tests/scc/execute/0022-typedef.c
+++ /dev/null
@@ -1,10 +1,0 @@
-typedef int x;
-
-int
-main()
-{
- x v;
- v = 0;
- return v;
-}
-
--- a/tests/scc/execute/0023-global.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int x;
-
-int
-main()
-{
- x = 0;
- return x;
-}
-
--- a/tests/scc/execute/0024-typedefstruct.c
+++ /dev/null
@@ -1,12 +1,0 @@
-typedef struct { int x; int y; } s;
-
-s v;
-
-int
-main()
-{
- v.x = 1;
- v.y = 2;
- return 3 - v.x - v.y;
-}
-
--- a/tests/scc/execute/0025-string.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int strlen(char *);
-
-int
-main()
-{
- char *p;
-
- p = "hello";
- return strlen(p) - 5;
-}
--- a/tests/scc/execute/0026-implicitret.c
+++ /dev/null
@@ -1,5 +1,0 @@
-main()
-{
- return 0;
-}
-
--- a/tests/scc/execute/0027-charval.c
+++ /dev/null
@@ -1,8 +1,0 @@
-int
-main()
-{
- char *p;
-
- p = "hello";
- return p[0] - 104;
-}
--- a/tests/scc/execute/0028-bor.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- x = x | 4;
- return x - 5;
-}
-
--- a/tests/scc/execute/0029-band.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- x = x & 3;
- return x - 1;
-}
-
--- a/tests/scc/execute/0030-bxor.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- x = x ^ 3;
- return x - 2;
-}
-
--- a/tests/scc/execute/0031-relop.c
+++ /dev/null
@@ -1,24 +1,0 @@
-int
-f()
-{
- return 100;
-}
-
-int
-main()
-{
- if (f() > 1000)
- return 1;
- if (f() >= 1000)
- return 1;
- if (1000 < f())
- return 1;
- if (1000 <= f())
- return 1;
- if (1000 == f())
- return 1;
- if (100 != f())
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0032-indec.c
+++ /dev/null
@@ -1,48 +1,0 @@
-int
-zero()
-{
- return 0;
-}
-
-int
-one()
-{
- return 1;
-}
-
-int
-main()
-{
- int x;
- int y;
-
- x = zero();
- y = ++x;
- if (x != 1)
- return 1;
- if (y != 1)
- return 1;
-
- x = one();
- y = --x;
- if (x != 0)
- return 1;
- if (y != 0)
- return 1;
-
- x = zero();
- y = x++;
- if (x != 1)
- return 1;
- if (y != 0)
- return 1;
-
- x = one();
- y = x--;
- if (x != 0)
- return 1;
- if (y != 1)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0033-ptrindec.c
+++ /dev/null
@@ -1,30 +1,0 @@
-int
-main()
-{
- int arr[2];
- int *p;
-
- arr[0] = 2;
- arr[1] = 3;
- p = &arr[0];
- if(*(p++) != 2)
- return 1;
- if(*(p++) != 3)
- return 2;
-
- p = &arr[1];
- if(*(p--) != 3)
- return 1;
- if(*(p--) != 2)
- return 2;
-
- p = &arr[0];
- if(*(++p) != 3)
- return 1;
-
- p = &arr[1];
- if(*(--p) != 2)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0034-logandor.c
+++ /dev/null
@@ -1,45 +1,0 @@
-int g;
-
-int
-effect()
-{
- g = 1;
- return 1;
-}
-
-int
-main()
-{
- int x;
-
- g = 0;
- x = 0;
- if(x && effect())
- return 1;
- if(g)
- return 2;
- x = 1;
- if(x && effect()) {
- if(g != 1)
- return 3;
- } else {
- return 4;
- }
- g = 0;
- x = 1;
- if(x || effect()) {
- if(g)
- return 5;
- } else {
- return 6;
- }
- x = 0;
- if(x || effect()) {
- if(g != 1)
- return 7;
- } else {
- return 8;
- }
- return 0;
-}
-
--- a/tests/scc/execute/0035-breakcont.c
+++ /dev/null
@@ -1,32 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 0;
- while(1)
- break;
- while(1) {
- if (x == 5) {
- break;
- }
- x = x + 1;
- continue;
- }
- for (;;) {
- if (x == 10) {
- break;
- }
- x = x + 1;
- continue;
- }
- do {
- if (x == 15) {
- break;
- }
- x = x + 1;
- continue;
- } while(1);
- return x - 15;
-}
-
--- a/tests/scc/execute/0036-notneg.c
+++ /dev/null
@@ -1,15 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 4;
- if(!x != 0)
- return 1;
- if(!!x != 1)
- return 1;
- if(-x != 0 - 4)
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0037-assignop.c
+++ /dev/null
@@ -1,19 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 0;
- x += 2;
- x += 2;
- if (x != 4)
- return 1;
- x -= 1;
- if (x != 3)
- return 2;
- x *= 2;
- if (x != 6)
- return 3;
-
- return 0;
-}
--- a/tests/scc/execute/0038-ptradd.c
+++ /dev/null
@@ -1,17 +1,0 @@
-int
-main()
-{
- int x[2];
- int *p;
-
- x[1] = 7;
- p = &x[0];
- p = p + 1;
-
- if(*p != 7)
- return 1;
- if(&x[1] - &x[0] != 1)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0039-sizeof.c
+++ /dev/null
@@ -1,17 +1,0 @@
-int
-main()
-{
- int x, *p;
-
- if (sizeof(0) < 2)
- return 1;
- if (sizeof 0 < 2)
- return 1;
- if (sizeof(char) < 1)
- return 1;
- if (sizeof(int) - 2 < 0)
- return 1;
- if (sizeof(&x) != sizeof p)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0040-cast.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int
-main()
-{
- void *p;
- int x;
-
- x = 2;
- p = &x;
-
- if(*((int*)p) != 2)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0041-queen.c
+++ /dev/null
@@ -1,55 +1,0 @@
-int *calloc(int, int);
-
-int N;
-int *t;
-
-int
-chk(int x, int y)
-{
- int i;
- int r;
-
- for (r=i=0; i<8; i++) {
- r = r + t[x + 8*i];
- r = r + t[i + 8*y];
- if (x+i < 8 & y+i < 8)
- r = r + t[x+i + 8*(y+i)];
- if (x+i < 8 & y-i >= 0)
- r = r + t[x+i + 8*(y-i)];
- if (x-i >= 0 & y+i < 8)
- r = r + t[x-i + 8*(y+i)];
- if (x-i >= 0 & y-i >= 0)
- r = r + t[x-i + 8*(y-i)];
- }
- return r;
-}
-
-int
-go(int n, int x, int y)
-{
- if (n == 8) {
- N++;
- return 0;
- }
- for (; y<8; y++) {
- for (; x<8; x++)
- if (chk(x, y) == 0) {
- t[x + 8*y]++;
- go(n+1, x, y);
- t[x + 8*y]--;
- }
- x = 0;
- }
- return 0;
-}
-
-int
-main()
-{
- t = calloc(64, sizeof(int));
- go(0, 0, 0);
- if(N != 92)
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0042-prime.c
+++ /dev/null
@@ -1,26 +1,0 @@
-int
-main() {
- int n;
- int t;
- int c;
- int p;
-
- c = 0;
- n = 2;
- while (n < 5000) {
- t = 2;
- p = 1;
- while (t*t <= n) {
- if (n % t == 0)
- p = 0;
- t++;
- }
- n++;
- if (p)
- c++;
- }
- if (c != 669)
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0043-union.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- union { int a; int b; } u;
- u.a = 1;
- u.b = 3;
-
- if (u.a != 3 || u.b != 3)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0044-struct.c
+++ /dev/null
@@ -1,19 +1,0 @@
-struct s {
- int x;
- struct {
- int y;
- int z;
- } nest;
-};
-
-int
-main() {
- struct s v;
- v.x = 1;
- v.nest.y = 2;
- v.nest.z = 3;
- if (v.x + v.nest.y + v.nest.z != 6)
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0045-struct.c
+++ /dev/null
@@ -1,16 +1,0 @@
-struct T;
-
-struct T {
- int x;
-};
-
-int
-main()
-{
- struct T v;
- { struct T { int z; }; }
- v.x = 2;
- if(v.x != 2)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0046-inits.c
+++ /dev/null
@@ -1,16 +1,0 @@
-int x = 5;
-long y = 6;
-int *p = &x;
-
-int
-main()
-{
- if (x != 5)
- return 1;
- if (y != 6)
- return 2;
- if (*p != 5)
- return 3;
- return 0;
-}
-
--- a/tests/scc/execute/0047-anonexport.c
+++ /dev/null
@@ -1,34 +1,0 @@
-typedef struct {
- int a;
- union {
- int b1;
- int b2;
- };
- struct { union { struct { int c; }; struct {}; }; };
- struct {};
- struct {
- int d;
- };
-} s;
-
-int
-main()
-{
- s v;
-
- v.a = 1;
- v.b1 = 2;
- v.c = 3;
- v.d = 4;
-
- if (v.a != 1)
- return 1;
- if (v.b1 != 2 && v.b2 != 2)
- return 2;
- if (v.c != 3)
- return 3;
- if (v.d != 4)
- return 4;
-
- return 0;
-}
--- a/tests/scc/execute/0048-inits.c
+++ /dev/null
@@ -1,14 +1,0 @@
-struct { int a; int b; int c; } s = {1, 2, 3};
-
-int
-main()
-{
- if (s.a != 1)
- return 1;
- if (s.b != 2)
- return 2;
- if (s.c != 3)
- return 3;
-
- return 0;
-}
--- a/tests/scc/execute/0049-inits.c
+++ /dev/null
@@ -1,12 +1,0 @@
-struct S {int a; int b;};
-struct S s = { .b = 2, .a = 1};
-
-int
-main()
-{
- if(s.a != 1)
- return 1;
- if(s.b != 2)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0050-inits.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int x = 10;
-
-struct S {int a; int *p;};
-struct S s = { .p = &x, .a = 1};
-
-int
-main()
-{
- if(s.a != 1)
- return 1;
- if(*s.p != 10)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0051-inits.c
+++ /dev/null
@@ -1,33 +1,0 @@
-struct S1 {
- int a;
- int b;
-};
-
-struct S2 {
- int a;
- int b;
- union {
- int c;
- int d;
- };
- struct S1 s;
-};
-
-struct S2 v = {1, 2, 3, {4, 5}};
-
-int
-main()
-{
- if(v.a != 1)
- return 1;
- if(v.b != 2)
- return 2;
- if(v.c != 3 || v.d != 3)
- return 3;
- if(v.s.a != 4)
- return 4;
- if(v.s.b != 5)
- return 5;
-
- return 0;
-}
--- a/tests/scc/execute/0052-switch.c
+++ /dev/null
@@ -1,38 +1,0 @@
-int x = 0;
-
-int
-main()
-{
- switch(x)
- case 0:
- ;
- switch(x)
- case 0:
- switch(x) {
- case 0:
- goto next;
- default:
- return 1;
- }
- return 1;
- next:
- switch(x)
- case 1:
- return 1;
- switch(x) {
- {
- x = 1 + 1;
- foo:
- case 1:
- return 1;
- }
- }
- switch(x) {
- case 0:
- return x;
- case 1:
- return 1;
- default:
- return 1;
- }
-}
--- a/tests/scc/execute/0053-struct.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- struct T { int x; };
- {
- struct T s;
- s.x = 0;
- return s.x;
- }
-}
--- a/tests/scc/execute/0054-struct.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int
-main()
-{
- struct T { int x; } s1;
- s1.x = 1;
- {
- struct T { int y; } s2;
- s2.y = 1;
- if (s1.x - s2.y != 0)
- return 1;
- }
- return 0;
-}
--- a/tests/scc/execute/0055-enum.c
+++ /dev/null
@@ -1,22 +1,0 @@
-enum E {
- x,
- y,
- z,
-};
-
-int
-main()
-{
- enum E e;
-
- if(x != 0)
- return 1;
- if(y != 1)
- return 2;
- if(z != 2)
- return 3;
-
- e = x;
- return e;
-}
-
--- a/tests/scc/execute/0056-enum.c
+++ /dev/null
@@ -1,22 +1,0 @@
-enum E {
- x,
- y = 2,
- z,
-};
-
-int
-main()
-{
- enum E e;
-
- if(x != 0)
- return 1;
- if(y != 2)
- return 2;
- if(z != 3)
- return 3;
-
- e = x;
- return e;
-}
-
--- a/tests/scc/execute/0057-duff.c
+++ /dev/null
@@ -1,30 +1,0 @@
-int main()
-{
- int count, n;
- char *from, *to;
- char a[39], b[39];
-
- for(n = 0; n < 39; n++) {
- a[n] = n;
- b[n] = 0;
- }
- from = a;
- to = b;
- count = 39;
- n = (count + 7) / 8;
- switch (count % 8) {
- case 0: do { *to++ = *from++;
- case 7: *to++ = *from++;
- case 6: *to++ = *from++;
- case 5: *to++ = *from++;
- case 4: *to++ = *from++;
- case 3: *to++ = *from++;
- case 2: *to++ = *from++;
- case 1: *to++ = *from++;
- } while (--n > 0);
- }
- for(n = 0; n < 39; n++)
- if(a[n] != b[n])
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0058-bug.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int
-main()
-{
- char a[16], b[16];
-
- if(sizeof(a) != sizeof(b))
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0059-multistring.c
+++ /dev/null
@@ -1,15 +1,0 @@
-int main()
-{
- char * s;
-
- s = "abc" "def";
- if(s[0] != 'a') return 1;
- if(s[1] != 'b') return 2;
- if(s[2] != 'c') return 3;
- if(s[3] != 'd') return 4;
- if(s[4] != 'e') return 5;
- if(s[5] != 'f') return 6;
- if(s[6] != 0) return 7;
-
- return 0;
-}
--- a/tests/scc/execute/0060-charlit.c
+++ /dev/null
@@ -1,8 +1,0 @@
-int
-main()
-{
- if ('a' != 97)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0061-comments.c
+++ /dev/null
@@ -1,11 +1,0 @@
-// line comment
-
-int
-main()
-{
- /*
- multiline
- comment
- */
- return 0;
-}
--- a/tests/scc/execute/0062-include.c
+++ /dev/null
@@ -1,4 +1,0 @@
-#include \
-"include/0062-include.h"
- return x;
-}
--- a/tests/scc/execute/0063-define.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#define FOO 0
-
-int main()
-{
- return FOO;
-}
-
--- a/tests/scc/execute/0064-sysinclude.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <0064-sysinclude.h>
-
-int
-main()
-{
- return x - y;
-}
--- a/tests/scc/execute/0065-ifdef.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#ifdef FOO
- XXX
-#ifdef BAR
- XXX
-#endif
- XXX
-#endif
-
-#define FOO 1
-
-#ifdef FOO
-
-#ifdef FOO
-int x = 0;
-#endif
-
-int
-main()
-{
- return x;
-}
-#endif
-
-
-
--- a/tests/scc/execute/0066-cppelse.c
+++ /dev/null
@@ -1,20 +1,0 @@
-#define BAR 0
-#ifdef BAR
- #ifdef FOO
- XXX
- #ifdef FOO
- XXX
- #endif
- #else
- #define FOO
- #ifdef FOO
- int x = BAR;
- #endif
- #endif
-#endif
-
-int
-main()
-{
- return BAR;
-}
--- a/tests/scc/execute/0067-define.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#define X 6 / 2
-
-int
-main()
-{
- return X - 3;
-}
--- a/tests/scc/execute/0068-funclikemacro.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#define ADD(X, Y) (X + Y)
-
-
-int
-main()
-{
- return ADD(1, 2) - 3;
-}
--- a/tests/scc/execute/0069-funclikemacro.c
+++ /dev/null
@@ -1,11 +1,0 @@
-#define A 3
-#define FOO(X,Y,Z) X + Y + Z
-#define SEMI ;
-
-int
-main()
-{
- if(FOO(1, 2, A) != 6)
- return 1 SEMI
- return FOO(0,0,0);
-}
--- a/tests/scc/execute/0070-cppif.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#if 1
-int x = 0;
-#endif
-
-#if 0
-int x = 1;
-#if 1
- X
-#endif
-#ifndef AAA
- X
-#endif
-#endif
-
-int main()
-{
- return x;
-}
--- a/tests/scc/execute/0071-cppelif.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#if 0
-X
-#elif 1
-int x = 0;
-#else
-X
-#endif
-
-int
-main()
-{
- return x;
-}
--- a/tests/scc/execute/0072-cppelif.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#if 0
-X
-#elif 0
-X
-#elif 1
-int x = 0;
-#endif
-
-int
-main()
-{
- return x;
-}
--- a/tests/scc/execute/0073-ifndef.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef DEF
-int x = 0;
-#endif
-
-#define DEF
-
-#ifndef DEF
-X
-#endif
-
-int
-main()
-{
- return x;
-}
--- a/tests/scc/execute/0074-undef.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#define X 1
-#undef X
-
-#ifdef X
-FAIL
-#endif
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0075-ptraddasn.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[0];
- p += 1;
- *p = 123;
-
- if(arr[1] != 123)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0076-ptrsubasn.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int
-main()
-{
- int arr[2];
- int *p;
-
- p = &arr[1];
- p -= 1;
- *p = 123;
-
- if(arr[0] != 123)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0077-defined.c
+++ /dev/null
@@ -1,32 +1,0 @@
-#if defined X
-X
-#endif
-
-#if defined(X)
-X
-#endif
-
-#if X
-X
-#endif
-
-#define X 0
-
-#if X
-X
-#endif
-
-#if defined(X)
-int x = 0;
-#endif
-
-#undef X
-#define X 1
-
-#if X
-int
-main()
-{
- return 0;
-}
-#endif
--- a/tests/scc/execute/0078-dirifexpr.c
+++ /dev/null
@@ -1,166 +1,0 @@
-#if (-2) != -2
-#error fail
-#endif
-
-#if (0 || 0) != 0
-#error fail
-#endif
-
-#if (1 || 0) != 1
-#error fail
-#endif
-
-#if (1 || 1) != 1
-#error fail
-#endif
-
-#if (0 && 0) != 0
-#error fail
-#endif
-
-#if (1 && 0) != 0
-#error fail
-#endif
-
-#if (0 && 1) != 0
-#error fail
-#endif
-
-#if (1 && 1) != 1
-#error fail
-#endif
-
-#if (0xf0 | 1) != 0xf1
-#error fail
-#endif
-
-#if (0xf0 & 1) != 0
-#error fail
-#endif
-
-#if (0xf0 & 0x1f) != 0x10
-#error fail
-#endif
-
-#if (1 ^ 1) != 0
-#error fail
-#endif
-
-#if (1 == 1) != 1
-#error fail
-#endif
-
-#if (1 == 0) != 0
-#error fail
-#endif
-
-#if (1 != 1) != 0
-#error fail
-#endif
-
-#if (0 != 1) != 1
-#error fail
-#endif
-
-#if (0 > 1) != 0
-#error fail
-#endif
-
-#if (0 < 1) != 1
-#error fail
-#endif
-
-#if (0 > -1) != 1
-#error fail
-#endif
-
-#if (0 < -1) != 0
-#error fail
-#endif
-
-#if (0 >= 1) != 0
-#error fail
-#endif
-
-#if (0 <= 1) != 1
-#error fail
-#endif
-
-#if (0 >= -1) != 1
-#error fail
-#endif
-
-#if (0 <= -1) != 0
-#error fail
-#endif
-
-#if (0 < 0) != 0
-#error fail
-#endif
-
-#if (0 <= 0) != 1
-#error fail
-#endif
-
-#if (0 > 0) != 0
-#error fail
-#endif
-
-#if (0 >= 0) != 1
-#error fail
-#endif
-
-#if (1 << 1) != 2
-#error fail
-#endif
-
-#if (2 >> 1) != 1
-#error fail
-#endif
-
-#if (2 + 1) != 3
-#error fail
-#endif
-
-#if (2 - 3) != -1
-#error fail
-#endif
-
-#if (2 * 3) != 6
-#error fail
-#endif
-
-#if (6 / 3) != 2
-#error fail
-#endif
-
-#if (7 % 3) != 1
-#error fail
-#endif
-
-#if (2+2*3+2) != 10
-#error fail
-#endif
-
-#if ((2+2)*(3+2)) != 20
-#error fail
-#endif
-
-#if (2 + 2 + 2 + 2 == 2 + 2 * 3) != 1
-#error fail
-#endif
-
-#if (0 ? 1 : 3) != 3
-#error fail
-#endif
-
-#if (1 ? 3 : 1) != 3
-#error fail
-#endif
-
-int
-main()
-{
- return 0;
-}
-
--- a/tests/scc/execute/0079-cond.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int
-main()
-{
- if(0 ? 1 : 0)
- return 1;
- if(1 ? 0 : 1)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0080-arrays.c
+++ /dev/null
@@ -1,48 +1,0 @@
-int
-foo(int x[100])
-{
- int y[100];
- int *p;
-
- y[0] = 2000;
-
- if(x[0] != 1000)
- {
- return 1;
- }
-
- p = x;
-
- if(p[0] != 1000)
- {
- return 2;
- }
-
- p = y;
-
- if(p[0] != 2000)
- {
- return 3;
- }
-
- if(sizeof(x) != sizeof(void*))
- {
- return 4;
- }
-
- if(sizeof(y) <= sizeof(x))
- {
- return 5;
- }
-
- return 0;
-}
-
-int
-main()
-{
- int x[100];
- x[0] = 1000;
-
- return foo(x);
-}
--- a/tests/scc/execute/0081-calls.c
+++ /dev/null
@@ -1,17 +1,0 @@
-int
-f1(char *p)
-{
- return *p+1;
-}
-
-int
-main()
-{
- char s = 1;
- int v[1000];
- int f1(char *);
-
- if (f1(&s) != 2)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0082-bug.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#define x(y) ((y) + 1)
-
-int
-main()
-{
- int x;
- int y;
-
- y = 0;
- x = x(y);
-
- if(x != 1)
- return 1;
-
- return 0;
-}
-
--- a/tests/scc/execute/0083-voidret.c
+++ /dev/null
@@ -1,12 +1,0 @@
-void
-voidfn()
-{
- return;
-}
-
-int
-main()
-{
- voidfn();
- return 0;
-}
--- a/tests/scc/execute/0084-longlong.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- long long x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0085-ulonglong.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- unsigned long long x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0086-variadic.c
+++ /dev/null
@@ -1,55 +1,0 @@
-#define CALL(FUN, ...) FUN(__VA_ARGS__)
-
-int
-none()
-{
- return 0;
-}
-
-int
-one(int a)
-{
- if (a != 1)
- return 1;
-
- return 0;
-}
-
-int
-two(int a, int b)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
-
- return 0;
-}
-
-int
-three(int a, int b, int c)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
- if (c != 3)
- return 1;
-
- return 0;
-}
-
-int
-main()
-{
- if (CALL(none))
- return 1;
- if (CALL(one, 1))
- return 2;
- if (CALL(two, 1, 2))
- return 3;
- if (CALL(three, 1, 2, 3))
- return 4;
-
- return 0;
-}
--- a/tests/scc/execute/0087-variadic.c
+++ /dev/null
@@ -1,54 +1,0 @@
-#define ARGS(...) __VA_ARGS__
-
-int
-none()
-{
- return 0;
-}
-
-int
-one(int a)
-{
- if (a != 1)
- return 1;
-
- return 0;
-}
-
-int
-two(int a, int b)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
-
- return 0;
-}
-
-int
-three(int a, int b, int c)
-{
- if (a != 1)
- return 1;
- if (b != 2)
- return 1;
- if (c != 3)
- return 1;
-
- return 0;
-}
-
-int
-main()
-{
- if (none(ARGS()))
- return 1;
- if (one(ARGS(1)))
- return 2;
- if (two(ARGS(1, 2)))
- return 3;
- if (three(ARGS(1, 2, 3)))
- return 4;
- return 0;
-}
--- a/tests/scc/execute/0088-macros.c
+++ /dev/null
@@ -1,30 +1,0 @@
-#define ZERO_0() 0
-#define ZERO_1(A) 0
-#define ZERO_2(A, B) 0
-#define ZERO_VAR(...) 0
-#define ZERO_1_VAR(A, ...) 0
-
-int
-main()
-{
- if (ZERO_0())
- return 1;
- if (ZERO_1(1))
- return 1;
- if (ZERO_2(1, 2))
- return 1;
- if (ZERO_VAR())
- return 1;
- if (ZERO_VAR(1))
- return 1;
- if (ZERO_VAR(1, 2))
- return 1;
- if (ZERO_1_VAR(1))
- return 1;
- if (ZERO_1_VAR(1, 2))
- return 1;
- if (ZERO_1_VAR(1, 2, 3))
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0089-short.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- short x;
-
- x = 0;
- x = x + 1;
- if (x != 1)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0090-fptr.c
+++ /dev/null
@@ -1,20 +1,0 @@
-struct S
-{
- int (*fptr)();
-};
-
-int
-foo()
-{
- return 0;
-}
-
-int
-main()
-{
- struct S v;
-
- v.fptr = foo;
- return v.fptr();
-}
-
--- a/tests/scc/execute/0091-fptr.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int (*fptr)() = 0;
-
-
-int
-main()
-{
- if (fptr)
- return 1;
- return 0;
-}
-
--- a/tests/scc/execute/0092-fptr.c
+++ /dev/null
@@ -1,30 +1,0 @@
-int
-zero()
-{
- return 0;
-}
-
-struct S
-{
- int (*zerofunc)();
-} s = { &zero };
-
-struct S *
-anon()
-{
- return &s;
-}
-
-typedef struct S * (*fty)();
-
-fty
-go()
-{
- return &anon;
-}
-
-int
-main()
-{
- return go()()->zerofunc();
-}
--- a/tests/scc/execute/0093-arrayinit.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int a[3] = {0, 1, 2};
-
-int
-main()
-{
- if (a[0] != 0)
- return 1;
- if (a[1] != 1)
- return 2;
- if (a[2] != 2)
- return 3;
-
- return 0;
-}
--- a/tests/scc/execute/0094-arrayinit.c
+++ /dev/null
@@ -1,19 +1,0 @@
-typedef struct {
- int v;
- int sub[2];
-} S;
-
-S a[1] = {{1, {2, 3}}};
-
-int
-main()
-{
- if (a[0].v != 1)
- return 1;
- if (a[0].sub[0] != 2)
- return 2;
- if (a[0].sub[1] != 3)
- return 3;
-
- return 0;
-}
--- a/tests/scc/execute/0095-arrayselector.c
+++ /dev/null
@@ -1,19 +1,0 @@
-int a[] = {5, [2] = 2, 3};
-
-int
-main()
-{
- if (sizeof(a) != 4*sizeof(int))
- return 1;
-
- if (a[0] != 5)
- return 2;
- if (a[1] != 0)
- return 3;
- if (a[2] != 2)
- return 4;
- if (a[3] != 3)
- return 5;
-
- return 0;
-}
--- a/tests/scc/execute/0096-inferredarraysize.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int a[] = {1, 2, 3, 4};
-
-int
-main()
-{
- if (sizeof(a) != 4*sizeof(int))
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0097-extern.c
+++ /dev/null
@@ -1,6 +1,0 @@
-extern int x;
-
-int main()
-{
- return 0;
-}
--- a/tests/scc/execute/0098-tentative.c
+++ /dev/null
@@ -1,22 +1,0 @@
-int x;
-int x = 3;
-int x;
-
-int main();
-
-void *
-foo()
-{
- return &main;
-}
-
-int
-main()
-{
- if (x != 3)
- return 0;
-
- x = 0;
- return x;
-}
-
--- a/tests/scc/execute/0099-tentative.c
+++ /dev/null
@@ -1,12 +1,0 @@
-int x, x = 3, x;
-
-int
-main()
-{
- if (x != 3)
- return 0;
-
- x = 0;
- return x;
-}
-
--- a/tests/scc/execute/0100-redeclaremacro.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#define NULL ((void*)0)
-#define NULL ((void*)0)
-
-#define FOO(X, Y) (X + Y + Z)
-#define FOO(X, Y) (X + Y + Z)
-
-#define BAR(X, Y, ...) (X + Y + Z)
-#define BAR(X, Y, ...) (X + Y + Z)
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0101-wcharlit.c
+++ /dev/null
@@ -1,5 +1,0 @@
-int
-main()
-{
- return L'\0';
-}
--- a/tests/scc/execute/0102-bug.c
+++ /dev/null
@@ -1,14 +1,0 @@
-// This wouldn't compile
-
-typedef struct { } Vec;
-
-static void
-vecresize(Vec *v, int cap)
-{
- return;
-}
-
-int main()
-{
- return 0;
-}
--- a/tests/scc/execute/0103-voidparm.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-foo(void)
-{
- return 0;
-}
-
-int
-main()
-{
- return foo();
-}
--- a/tests/scc/execute/0104-qbebug.c
+++ /dev/null
@@ -1,10 +1,0 @@
-int
-main()
-{
- int c;
- c = 0;
- do
- ;
- while (0);
- return c;
-}
--- a/tests/scc/execute/0105-shl.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 1;
- if ((x << 1) != 2)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0106-ppcast.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int
-main()
-{
- int x;
- void *foo;
- void **bar;
-
- x = 0;
-
- foo = (void*)&x;
- bar = &foo;
-
- return **(int**)bar;
-}
--- a/tests/scc/execute/0107-bnot.c
+++ /dev/null
@@ -1,22 +1,0 @@
-#include <stdint.h>
-
-int
-main()
-{
- int32_t x;
- int64_t l;
-
- x = 0;
- l = 0;
-
- x = ~x;
- if (x != 0xffffffff)
- return 1;
-
- l = ~l;
- if (x != 0xffffffffffffffff)
- return 2;
-
-
- return 0;
-}
--- a/tests/scc/execute/0108-bug.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int i;
-
- for(i = 0; i < 10; i++)
- if (!i)
- continue;
-
- return 0;
-}
--- a/tests/scc/execute/0109-struct.c
+++ /dev/null
@@ -1,10 +1,0 @@
-struct S1 { int x; };
-struct S2 { struct S1 s1; };
-
-int
-main()
-{
- struct S2 s2;
- s2.s1.x = 1;
- return 0;
-}
--- a/tests/scc/execute/0110-typedefcast.c
+++ /dev/null
@@ -1,8 +1,0 @@
-typedef int myint;
-myint x = (myint)1;
-
-int
-main(void)
-{
- return x-1;
-}
--- a/tests/scc/execute/0111-doubledef.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int foo(void);
-int foo(void);
-#define FOO 0
-
-int
-main()
-{
- return FOO;
-}
--- a/tests/scc/execute/0112-cond.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-main()
-{
- int x = 0;
- int y = 1;
- if(x ? 1 : 0)
- return 1;
- if(y ? 0 : 1)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0113-externredecl.c
+++ /dev/null
@@ -1,8 +1,0 @@
-extern int x;
-int x;
-
-int
-main()
-{
- return x;
-}
--- a/tests/scc/execute/0114-shortassig.c
+++ /dev/null
@@ -1,9 +1,0 @@
-int
-main()
-{
- short s = 1;
- long l = 1;
-
- s -= l;
- return s;
-}
--- a/tests/scc/execute/0115-null-comparision.c
+++ /dev/null
@@ -1,5 +1,0 @@
-int
-main()
-{
- return "abc" == (void *)0;
-}
--- a/tests/scc/execute/0116-floatcmp.c
+++ /dev/null
@@ -1,8 +1,0 @@
-int
-main()
-{
- int a = 0;
- float f = a + 1;
-
- return f == a;
-}
--- a/tests/scc/execute/0117-pointarith.c
+++ /dev/null
@@ -1,7 +1,0 @@
-int
-main()
-{
- int i, *p = &i;
-
- return p - (void*) 0 == 0;
-}
--- a/tests/scc/execute/0118-voidmain.c
+++ /dev/null
@@ -1,7 +1,0 @@
-int main(void);
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0119-macrostr.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#define B "b"
-
-char s[] = "a" B "c";
-
-int
-main()
-{
- if (s[0] != 'a')
- return 1;
- if (s[1] != 'b')
- return 2;
- if (s[2] != 'c')
- return 3;
- if (s[3] != '\0')
- return 4;
- return 0;
-}
--- a/tests/scc/execute/0120-funpar.c
+++ /dev/null
@@ -1,11 +1,0 @@
-int
-f(int f)
-{
- return f;
-}
-
-int
-main()
-{
- return f(0);
-}
--- a/tests/scc/execute/0121-localinit.c
+++ /dev/null
@@ -1,5 +1,0 @@
-main()
-{
- int x[] = { 1, 0 };
- return x[1];
-}
--- a/tests/scc/execute/0122-localinit.c
+++ /dev/null
@@ -1,6 +1,0 @@
-int
-main()
-{
- struct { int x; } s = { 0 };
- return s.x;
-}
--- a/tests/scc/execute/0123-doubleconst.c
+++ /dev/null
@@ -1,7 +1,0 @@
-double x = 100;
-
-int
-main()
-{
- return x < 1;
-}
--- a/tests/scc/execute/0124-enumstruct.c
+++ /dev/null
@@ -1,10 +1,0 @@
-struct {
- enum { X } x;
-} s;
-
-
-int
-main()
-{
- return X;
-}
--- a/tests/scc/execute/0125-fundcl.c
+++ /dev/null
@@ -1,20 +1,0 @@
-int f(int a), g(int a), a;
-
-
-int
-main()
-{
- return f(1) - g(1);
-}
-
-int
-f(int a)
-{
- return a;
-}
-
-int
-g(int a)
-{
- return a;
-}
--- a/tests/scc/execute/0126-macropar.c
+++ /dev/null
@@ -1,6 +1,0 @@
-#define F(a, b) a
-int
-main()
-{
- return F(, 1) 0;
-}
--- a/tests/scc/execute/0127-doublecte.c
+++ /dev/null
@@ -1,7 +1,0 @@
-double x = 100.0;
-
-int
-main()
-{
- return x < 1;
-}
--- a/tests/scc/execute/0128-kr_names.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int f(a,b);
-
-int
-f(a,b,c) char b;
-{
- return a - c + b;
-}
-
-int
-main(void)
-{
- return f(1,0,1);
-}
--- a/tests/scc/execute/0129-initi.c
+++ /dev/null
@@ -1,11 +1,0 @@
-struct range {
- long quant;
-} *a;
-long b;
-
-int
-main()
-{
- struct range r = a[0];
- b = r.quant;
-}
--- a/tests/scc/execute/0130-mulpars.c
+++ /dev/null
@@ -1,22 +1,0 @@
-int
-f2(int c, int b)
-{
- return c - b;
-}
-
-int (*
-f1(int a, int b))(int c, int b)
-{
- if (a != b)
- return f2;
- return 0;
-}
-
-int
-main()
-{
- int (* (*p)(int a, int b))(int c, int d) = f1;
-
-
- return (*(*p)(0, 2))(2, 2);
-}
--- a/tests/scc/execute/0131-hello.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-
-int
-main(void)
-{
- printf("hello world\n");
- return 0;
-}
--- a/tests/scc/execute/0132-forward.c
+++ /dev/null
@@ -1,21 +1,0 @@
-struct S *x;
-struct S {
- int i;
- struct S *next;
-};
-
-int
-main(void)
-{
- struct S y, *p;
- unsigned n;
-
- y.i = 0;
- y.next = 0;
- x = &y;
- *x = y;
-
- for (n = 0, p = &y; p; ++n, p = p->next)
- ;
- return n;
-}
--- a/tests/scc/execute/0133-ftn-ptr.c
+++ /dev/null
@@ -1,17 +1,0 @@
-int
-foo(void)
-{
- return 42;
-}
-
-int
-bar(void)
-{
- return 24;
-}
-
-int
-main(void)
-{
- return (1 ? foo : bar)();
-}
--- a/tests/scc/execute/0134-arith.c
+++ /dev/null
@@ -1,36 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 0;
- if ((x = x + 2) != 2) // 2
- return 1;
- if ((x = x - 1) != 1) // 1
- return 1;
- if ((x = x * 6) != 6) // 6
- return 1;
- if ((x = x / 2) != 3) // 3
- return 1;
- if ((x = x % 2) != 1) // 1
- return 1;
- if ((x = x << 2) != 4) // 4
- return 1;
- if ((x = x >> 1) != 2) // 2
- return 1;
- if ((x = x | 255) != 255) // 255
- return 1;
- if ((x = x & 3) != 3) // 3
- return 1;
- if ((x = x ^ 1) != 2) // 2
- return 1;
- if ((x = x + (x > 1)) != 2) // 2
- return 1;
- if ((x = x + (x < 3)) != 2) // 2
- return 1;
- if ((x = x + (x > 1)) != 3) // 3
- return 1;
- if ((x = x + (x < 4)) != 4) // 4
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0135-unary.c
+++ /dev/null
@@ -1,14 +1,0 @@
-int
-main()
-{
- int x;
-
- x = 3;
- x = !x; // 0
- x = !x; // 1
- x = ~x; // -1
- x = -x; // 2
- if(x != 2)
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0136-if.c
+++ /dev/null
@@ -1,21 +1,0 @@
-int c;
-
-int
-main()
-{
- if(0) {
- return 1;
- } else if(0) {
- /* empty */
- } else {
- if(1) {
- if(c)
- return 1;
- else
- return 0;
- } else {
- return 1;
- }
- }
- return 1;
-}
--- a/tests/scc/execute/0137-int-cast.c
+++ /dev/null
@@ -1,138 +1,0 @@
-int a;
-unsigned b;
-char c;
-signed char d;
-unsigned char e;
-long f;
-unsigned long g;
-long long h;
-unsigned long long i;
-short j;
-unsigned short k;
-
-int
-main(void)
-{
- a = b;
- a = c;
- a = d;
- a = e;
- a = f;
- a = g;
- a = h;
- a = i;
- a = j;
- a = k;
-
- b = a;
- b = c;
- b = d;
- b = e;
- b = f;
- b = g;
- b = h;
- b = i;
- b = j;
- b = k;
-
- c = a;
- c = b;
- c = d;
- c = e;
- c = f;
- c = g;
- c = h;
- c = i;
- c = j;
- c = k;
-
- d = a;
- d = b;
- d = c;
- d = e;
- d = f;
- d = g;
- d = h;
- d = i;
- d = j;
- d = k;
-
- e = a;
- e = b;
- e = c;
- e = d;
- e = f;
- e = g;
- e = h;
- e = i;
- e = j;
- e = k;
-
- f = a;
- f = b;
- f = c;
- f = d;
- f = e;
- f = g;
- f = h;
- f = i;
- f = j;
- f = k;
-
- g = a;
- g = b;
- g = c;
- g = d;
- g = e;
- g = f;
- g = h;
- g = i;
- g = j;
- g = k;
-
- h = a;
- h = b;
- h = c;
- h = d;
- h = e;
- h = f;
- h = g;
- h = i;
- h = j;
- h = k;
-
- i = a;
- i = b;
- i = c;
- i = d;
- i = e;
- i = f;
- i = g;
- i = h;
- i = j;
- i = k;
-
- j = a;
- j = b;
- j = c;
- j = d;
- j = e;
- j = f;
- j = g;
- j = h;
- j = i;
- j = k;
-
- k = a;
- k = b;
- k = c;
- k = d;
- k = e;
- k = f;
- k = g;
- k = h;
- k = j;
- k = i;
-
- return 0;
-}
--- a/tests/scc/execute/0138-namespace.c
+++ /dev/null
@@ -1,30 +1,0 @@
-typedef struct s s;
-
-struct s {
- struct s1 {
- int s;
- struct s2 {
- int s;
- } s1;
- } s;
-} s2;
-
-#define s s
-
-int
-main(void)
-{
-#undef s
- goto s;
- struct s s;
- {
- int s;
- return s;
- }
- return s.s.s + s.s.s1.s;
- s:
- {
- return 0;
- }
- return 1;
-}
--- a/tests/scc/execute/0139-ptr-ary.c
+++ /dev/null
@@ -1,22 +1,0 @@
-int
-main()
-{
- char arr[2][4], (*p)[4], *q;
- int v[4];
-
- p = arr;
- q = &arr[1][3];
- arr[1][3] = 2;
- v[0] = 2;
-
- if (arr[1][3] != 2)
- return 1;
- if (p[1][3] != 2)
- return 1;
- if (*q != 2)
- return 1;
- if (*v != 2)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0140-int-fold.c
+++ /dev/null
@@ -1,27 +1,0 @@
-int
-main(void)
-{
- int i;
-
- i = 1 + 2;
- i = 2 - 1;
- i = 3 * 6;
- i = 10 / 5;
- i = 10 % 5;
- i = i % 0;
- i = i % 0;
- i = 1 << 3;
- i = 8 >> 2;
- i = 12 & 4;
- i = 8 | 4;
- i = 12 ^ 4;
- i = -(3);
- i = ~12;
- i = 1 < 3;
- i = 2 > 3;
- i = 2 >= 3;
- i = 2 <= 3;
- i = 1 == 0;
-
- return 0;
-}
--- a/tests/scc/execute/0141-int-iden.c
+++ /dev/null
@@ -1,45 +1,0 @@
-int
-main(void)
-{
- int i;
-
- i = i || 0;
- i = i || 4;
- i = 4 || i;
- i = 0 || i;
- i = i && 0;
- i = i && 4;
- i = 4 && i;
- i = 0 && i;
- i = i << 0;
- i = 0 << i;
- i = i >> 0;
- i = 0 >> i;
- i = i + 0;
- i = 0 + i;
- i = i - 0;
- i = 0 - i;
- i = i | 0;
- i = 0 | i;
- i = i ^ 0;
- i = 0 ^ i;
- i = i * 0;
- i = 0 * i;
- i = i * 1;
- i = 1 * i;
- i = i / 1;
-
- if (i)
- i = 1 / i;
-
- i = i & ~0;
- i = ~0 & i;
- i = i % 1;
-
- if (0)
- i = i / 0;
- if (0)
- i = i % 0;
-
- return 0;
-}
--- a/tests/scc/execute/0142-char-const.c
+++ /dev/null
@@ -1,40 +1,0 @@
-int
-main(void)
-{
- unsigned char uc;
- signed char sc;
-
- uc = -1;
- if ((uc & 0xFF) != 0xFF)
- return 1;
-
- uc = '\x23';
- if (uc != 36)
- return 1;
-
- uc = 1u;
- if (uc != (1025 & 0xFF)
- return 1;
-
- uc = 'A';
- if (uc != 0x41)
- return 1;
-
- sc = -1;
- if ((sc & 0xFF) != 0xFF)
- return 1;
-
- sc = '\x23';
- if (sc != 36)
- return 1;
-
- sc = 1u;
- if (uc != (1025 & 0xFF)
- return 1;
-
- sc = 'A';
- if (uc != 0x41)
- return 1;
-
- return 0;
-}
--- a/tests/scc/execute/0143-int-const.c
+++ /dev/null
@@ -1,24 +1,0 @@
-main(void)
-{
- int i;
- unsigned u;
-
- i = 1;
- i = -1;
- i = -1l;
- i = -1u;
- i = -1ll;
- i = 32766 + 1 & 3;
- i = (int) 32768 < 0;
- i = -1u < 0;
-
- u = 1;
- u = -1;
- u = -1l;
- u = -1u;
- u = -1ll;
- u = (unsigned) 32768 < 0;
- u = 32766 + 1 & 3;
- u = -1u < 0;
- return 0;
-}
--- a/tests/scc/execute/0144-long-const.c
+++ /dev/null
@@ -1,25 +1,0 @@
-int
-main(void)
-{
- long i;
- unsigned long u;
-
- i = 1;
- i = -1;
- i = -1l;
- i = -1u;
- i = -1ll;
- i = (1ll << 32) - 1 & 3;
- i = (long) ((1ll << 32) - 1) < 0;
- i = -1u < 0;
-
- u = 1;
- u = -1;
- u = -1l;
- u = -1u;
- u = -1ll;
- u = (1ll << 32) - 1 & 3;
- u = (long) ((1ll << 32) - 1) < 0;
- u = -1u < 0;
- return 0;
-}
--- a/tests/scc/execute/0145-llong-const.c
+++ /dev/null
@@ -1,23 +1,0 @@
-int
-main(void)
-{
- long long i;
- unsigned long long u;
-
- i = 1;
- i = -1;
- i = -1l;
- i = -1u;
- i = -1ll;
- i = -1ll & 3;
- i = -1ll < 0;
-
- u = 1;
- u = -1;
- u = -1l;
- u = -1u;
- u = -1ll;
- u = -1llu & 3;
- u = -1llu < 0;
- return 0;
-}
--- a/tests/scc/execute/0146-ifdef.c
+++ /dev/null
@@ -1,52 +1,0 @@
-#define FOO
-
-#ifdef FOO
- int a;
- int b;
- #undef FOO
- #ifndef FOO
- int c;
- int d;
- #else
- int e;
- int f;
- #endif
- int e;
- int f;
- #ifdef FOO
- int c_;
- int d_;
- #else
- int e_;
- int f_;
- #endif
- int e_;
- int f_;
-int
-main()
-{
- return 0;
-}
-#else
- int j;
- int k;
- #ifdef FOO
- int j;
- int k;
- #else
- int n;
- int o;
- #endif
- int n;
- int o;
- #ifndef FOO
- int r;
- int s;
- #else
- int t;
- int u;
- #endif
- int t;
- int u;
- #error bad branch
-#endif
--- a/tests/scc/execute/0147-intern-cpp.c
+++ /dev/null
@@ -1,19 +1,0 @@
-#define x(y) (y)
-
-int
-main(void)
-{
- int y;
- char *p;
-
- p = __FILE__;
- y = __LINE__;
- p = __DATE__;
- y = __STDC__;
- p = __TIME__;
- y = __STDC_HOSTED__;
- y = __SCC__;
- y = x(1);
-
- return 0;
-}
--- a/tests/scc/execute/0148-cpp-string.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#define x(y) #y
-
-int
-main(void)
-{
- char *p;
- p = x(hello) " is better than bye";
-
- return (*p == 'h') ? 0 : 1;
-}
--- a/tests/scc/execute/0149-define.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#define M(x) x
-#define A(a,b) a(b)
-
-int
-main(void)
-{
- char *a = A(M,"hi");
-
- return (a[1] == 'i') ? 0 : 1;
-}
--- a/tests/scc/execute/0150-define.c
+++ /dev/null
@@ -1,15 +1,0 @@
-/*
- * f(2) will expand to 2*g, which will expand to 2*f, and in this
- * moment f will not be expanded because the macro definition is
- * a function alike macro, and in this case there is no arguments.
- */
-#define f(a) a*g
-#define g f
-
-int
-main(void)
-{
- int f = 0;
-
- return f(2);
-}
--- a/tests/scc/execute/0151-vararg.c
+++ /dev/null
@@ -1,25 +1,0 @@
-struct foo {
- int i, j, k;
- char *p;
- float v;
-};
-
-int
-f1(struct foo f, struct foo *p, int n, ...)
-{
- if (f.i != p->i)
- return 0;
- return p->j + n;
-}
-
-int
-main(void)
-{
- struct foo f;
-
- f.i = f.j = 1;
- f1(f, &f, 2);
- f1(f, &f, 2, 1, f, &f);
-
- return 0;
-}
--- a/tests/scc/execute/0152-cat.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#define CAT(x,y) x ## y
-#define XCAT(x,y) CAT(x,y)
-#define FOO foo
-#define BAR bar
-
-int
-main(void)
-{
- int foo, bar, foobar;
-
- CAT(foo,bar) = foo + bar;
- XCAT(FOO,BAR) = foo + bar;
- return 0;
-}
--- a/tests/scc/execute/0153-cpp-string.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#define M1(x) "This is a string $ or # or ## " ## #x
-#define STR "This is a string $ or # or ## and it is ok!"
-
-int
-main(void)
-{
- char *s, *t = M1(and it is ok!);
-
- for (s = STR; *s && *s == *t; ++s)
- ++t;
-
- return *s;
-}
--- a/tests/scc/execute/0154-if-defined.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#if defined(FOO)
-int a;
-#elif !defined(FOO) && defined(BAR)
-int b;
-#elif !defined(FOO) && !defined(BAR)
-int c;
-#else
-int d;
-#endif
-
-int
-main(void)
-{
- return c;
-}
--- a/tests/scc/execute/0155-struct-compl.c
+++ /dev/null
@@ -1,16 +1,0 @@
-extern struct X x;
-int foo();
-
-int main()
-{
- extern struct X x;
- return &x != 0;
-}
-
-struct X {int v;};
-
-int foo()
-{
- x.v = 0;
- return x.v;
-}
--- a/tests/scc/execute/0156-duff2.c
+++ /dev/null
@@ -1,35 +1,0 @@
-/*
- * Disgusting, no? But it compiles and runs just fine. I feel a
- * combination of pride and revulsion at this discovery. If no one's
- * thought of it before, I think I'll name it after myself. It amazes
- * me that after 10 years of writing C there are still little corners
- * that I haven't explored fully.
- * - Tom Duff
- */
-send(to, from, count)
- register short *to, *from;
- register count;
-{
- register n=(count+7)/8;
- switch(count%8){
- case 0: do{*to = *from++;
- case 7: *to = *from++;
- case 6: *to = *from++;
- case 5: *to = *from++;
- case 4: *to = *from++;
- case 3: *to = *from++;
- case 2: *to = *from++;
- case 1: *to = *from++;
- }while(--n>0);
- }
-}
-
-int
-main()
-{
- short a, b[40];
-
- send(&a, b, 40);
-
- return (a == b[39]) ? 0 : 1;
-}
--- a/tests/scc/execute/0157-list.c
+++ /dev/null
@@ -1,14 +1,0 @@
-typedef struct List List;
-struct List {
- int len;
- struct List *head;
- List *back;
-};
-
-int
-main(void)
-{
- List List;
-
- return List.len;
-}
--- a/tests/scc/execute/0158-ternary.c
+++ /dev/null
@@ -1,17 +1,0 @@
-int
-main(void)
-{
- int i, *q;
- void *p;
-
- i = i ? 0 : 0l;
- p = i ? (void *) 0 : 0;
- p = i ? 0 : (void *) 0;
- p = i ? 0 : (const void *) 0;
- q = i ? 0 : p;
- q = i ? p : 0;
- q = i ? q : 0;
- q = i ? 0 : q;
-
- return (int) q;
-}
--- a/tests/scc/execute/0159-typedef.c
+++ /dev/null
@@ -1,24 +1,0 @@
-/* Taken from plan9 kernel */
-
-typedef struct Clock0link Clock0link;
-typedef struct Clock0link {
- int (*clock)(void);
- Clock0link* link;
-} Clock0link;
-
-
-int
-f(void)
-{
- return 0;
-}
-
-Clock0link cl0 = {
- .clock = f;
-};
-
-int
-main(void)
-{
- return (*cl0.clock)();
-}
--- a/tests/scc/execute/0160-cpp-if.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#if 0 != (0 && (0/0))
- #error 0 != (0 && (0/0))
-#endif
-
-#if 1 != (-1 || (0/0))
- #error 1 != (-1 || (0/0))
-#endif
-
-#if 3 != (-1 ? 3 : (0/0))
- #error 3 != (-1 ? 3 : (0/0))
-#endif
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0161-struct.c
+++ /dev/null
@@ -1,12 +1,0 @@
-struct S { int a; int b; };
-struct S s = (struct S){1, 2};
-
-int
-main()
-{
- if(s.a != 1)
- return 1;
- if(s.b != 2)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0162-array.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int arr[3] = {[2] = 2, [0] = 0, [1] = 1};
-
-int
-main()
-{
- if(arr[0] != 0)
- return 1;
- if(arr[1] != 1)
- return 2;
- if(arr[2] != 2)
- return 3;
- return 0;
-}
--- a/tests/scc/execute/0163-array.c
+++ /dev/null
@@ -1,16 +1,0 @@
-struct S {int a; int b;};
-struct S arr[2] = {[1] = {3, 4}, [0] = {1, 2}};
-
-int
-main()
-{
- if(arr[0].a != 1)
- return 1;
- if(arr[0].b != 2)
- return 2;
- if(arr[1].a != 3)
- return 3;
- if(arr[1].b != 4)
- return 4;
- return 0;
-}
--- a/tests/scc/execute/0164-struct.c
+++ /dev/null
@@ -1,12 +1,0 @@
-struct S { int a; int b; };
-struct S *s = &(struct S) { 1, 2 };
-
-int
-main()
-{
- if(s->a != 1)
- return 1;
- if(s->b != 2)
- return 2;
- return 0;
-}
--- a/tests/scc/execute/0165-struct.c
+++ /dev/null
@@ -1,33 +1,0 @@
-struct S1 {
- int a;
- int b;
-};
-struct S2 {
- struct S1 s1;
- struct S1 *ps1;
- int arr[2];
-};
-struct S1 gs1 = (struct S1) {.a = 1, 2};
-struct S2 *s = &(struct S2) {
- {.b = 2, .a = 1},
- &gs1,
- {[0] = 1, 1+1}
-};
-
-int
-main()
-{
- if(s->s1.a != 1)
- return 1;
- if(s->s1.b != 2)
- return 2;
- if(s->ps1->a != 1)
- return 3;
- if(s->ps1->b != 2)
- return 4;
- if(s->arr[0] != 1)
- return 5;
- if(s->arr[1] != 2)
- return 6;
- return 0;
-}
--- a/tests/scc/execute/0166-desig.c
+++ /dev/null
@@ -1,18 +1,0 @@
-struct S {
- int a, b, c;
- char d[3];
- int e;
-} s = {
- .a = 1,
- .b = 2,
- .d = {[0] = 3, [2] = 5},
- .d = {[0] = 4, [1] = 6}
-};
-
-char m[] = {};
-
-int
-main(void)
-{
- return sizeof(m) == s.d[2];
-}
--- a/tests/scc/execute/0167-array.c
+++ /dev/null
@@ -1,15 +1,0 @@
-int arr1[][3] = {
- { 2, 7, 5, },
- { 5, 1, 2, },
-};
-
-int arr2[2][3] = {
- 2, 7, 5,
- 5, 1, 2
-};
-
-int
-main(void)
-{
- return !(arr1[1][2] == arr2[1][3]);
-}
--- a/tests/scc/execute/0168-array.c
+++ /dev/null
@@ -1,16 +1,0 @@
-int arr[][3][5] = {
- {
- { 0, 0, 3, 5 },
- { 1, [3] = 6, 7 },
- },
- {
- { 1, 2 },
- { [4] = 7, },
- },
-};
-
-int
-main(void)
-{
- return !(arr[0][1][4] == arr[1][1][4]);
-}
--- a/tests/scc/execute/0169-string.c
+++ /dev/null
@@ -1,27 +1,0 @@
-char s0[] = "foo";
-char s1[7] = "foo";
-char s2[2] = "foo";
-char s3[] = {"foo"};
-char *p = "foo";
-
-int
-cmp(char *s1, char *s2)
-{
- while (*s1 && *s1++ != *s2++)
- ;
- return *s1;
-}
-
-int
-main()
-{
- if (sizeof(s0) != 4 || cmp(s0, "foo"))
- return 1;
- if (cmp(s1, "foo"))
- return 1;
- if (s2[0] != 'f' || s2[1] != 'o')
- return 1;
- if (sizeof(s3) != 4 || cmp(s3, "foo"))
- return 1;
- return 0;
-}
--- a/tests/scc/execute/0170-line.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#undef line
-#define line 1000
-
-#line line
-#if 1000 != __LINE__
- #error " # line line" not work as expected
-#endif
-
-int
-main()
-{
- return 0;
-}
--- a/tests/scc/execute/0171-macros.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#define X (2)
-#define L (0)
-#define H (1)
-#define Q(x) x
-
-int
-main(void)
-{
- return X == L + H + Q(1);
-}
--- a/tests/scc/execute/0172-hexa.c
+++ /dev/null
@@ -1,13 +1,0 @@
-int
-main(void)
-{
- if (0xa != 0xA ||
- 0xb != 0xB ||
- 0xc != 0xC ||
- 0xd != 0xD ||
- 0xe != 0xE ||
- 0xf != 0xF) {
- return 1;
- }
- return 0;
-}
--- a/tests/scc/execute/0173-macro.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#define x f
-#define y() f
-
-typedef struct { int f; } S;
-
-int
-main()
-{
- S s;
-
- s.x = 0;
- return s.y();
-}
--- a/tests/scc/execute/0174-decay.c
+++ /dev/null
@@ -1,24 +1,0 @@
-int
-main(int argc, char *argv[])
-{
- int v[1];
- int (*p)[];
- int (*f1)(int ,char *[]);
- int (*f2)(int ,char *[]);
-
- v[0] = 0;
- p = &v;
- f1 = &main;
- f2 = main;
- if (argc == 0)
- return 1;
- if ((****main)(0, 0))
- return 2;
- if ((****f1)(0, 0))
- return 3;
- if ((****f2)(0, 0))
- return 4;
- if (!(*p)[0])
- return 0;
- return 1;
-}
--- a/tests/scc/execute/0175-defined.c
+++ /dev/null
@@ -1,32 +1,0 @@
-#if defined X
-X
-#endif
-
-#if defined(X)
-X
-#endif
-
-#if X
-X
-#endif
-
-#define X 0
-
-#if X
-X
-#endif
-
-#if defined(X)
-int x = 0;
-#endif
-
-#undef X
-#define X 1
-
-#if X
-int
-main()
-{
- return 0;
-}
-#endif
--- a/tests/scc/execute/0176-macro.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#ifdef __STDC__
-#define __(proto) proto
-#else
-#define __(proto) ()
-#endif
-
-extern int func __((int, int));
-
-int
-main()
-{
- int (*fun)(int,int) = func;
-
- return (*func)(1, 2);
-}
-
-int
-func(int a, int b)
-{
- return a - b - 1;
-}
--- a/tests/scc/execute/0177-literal.c
+++ /dev/null
@@ -1,9 +1,0 @@
-void boo(int *p)
-{
- return (*p[1] == 2) ? 0 : 1;
-}
-
-int main()
-{
- return boo((int[]) {0, 2});
-}
--- a/tests/scc/execute/0178-include.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#define FILE "0178-include.h"
-#include FILE
-
-int
-main()
-{
- return RET;
-}
--- a/tests/scc/execute/0178-include.h
+++ /dev/null
@@ -1,1 +1,0 @@
-#define RET 0
--- a/tests/scc/execute/0179-sizeof.c
+++ /dev/null
@@ -1,6 +1,0 @@
-int
-main(void)
-{
- sizeof((int) 1);
- return 0;
-}
--- a/tests/scc/execute/0180-incomplete.c
+++ /dev/null
@@ -1,13 +1,0 @@
-struct dummy;
-
-void *
-fun(struct dummy p[])
-{
- return p;
-}
-
-int
-main()
-{
- return fun(0) != 0;
-}
--- a/tests/scc/execute/0181-stringize.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#define XSTR(x) #x
-#define STR(x) XSTR(x)
-#define S y = "str"
-
-int
-main()
-{
- char *s, *t = STR(S);
-
- for (s = "y = \"str\""; *s && *t; ++s, ++t) {
- if (*s != *t)
- return 1;
- }
-
- return 0;
-}
--- a/tests/scc/execute/Makefile
+++ /dev/null
@@ -1,12 +1,0 @@
-.POSIX:
-
-ROOT=../../..
-
-all: tests
-
-tests:
- @CFLAGS='' SCCPREFIX=$(ROOT) PATH=$(ROOT)/bin:$$PATH ./chktest.sh scc-tests.lst
-
-clean:
- rm -f *.as *.o *.ir *.qbe *core test.log
-
--- a/tests/scc/execute/README
+++ /dev/null
@@ -1,2 +1,0 @@
-These tests are taken from https://github.com/andrewchambers/qc.
-All the credits for this test suite are for Andrew Chambers.
--- a/tests/scc/execute/chktest.sh
+++ /dev/null
@@ -1,24 +1,0 @@
-#!/bin/sh
-
-file=${1?' empty input file'}
-trap "rm -f a.out; exit" 0 1 2 3 15
-ulimit -c 0
-rm -f test.log
-
-SYS=`uname | tr A-Z a-z`
-FORMAT=elf
-ABI=sysv
-ARCH=amd64
-
-export SYS FORMAT ABI ARCH
-
-while read i state
-do
- echo $i >>test.log
- state=${state:-""}
- rm -f a.out
-
- (scc -Isysinclude $CFLAGS "$i" && ./a.out) 2>>test.log &&
- printf '[PASS]' || printf '[FAIL]'
- printf '\t%s\t%s\n' $i $state
-done < $file
--- a/tests/scc/execute/compose.sh
+++ /dev/null
@@ -1,23 +1,0 @@
-#!/bin/sh
-
-rm -f tmp_test.c
-rm -f tests.h
-rm -f tmp_*.c
-
-(echo '#include "tests.h"'
-echo 'int main()'
-echo '{'
-
-for i in *-*.c
-do
- n=`echo $i | sed 's/\(.*\)-.*\.c/\1/'`
- sed s/main/main_$n/ < $i > tmp_$n.c
- echo "int main_$n();" >> tests.h
- echo "main_$n();"
-
-done
-
-echo 'return 0;'
-echo '}'
-) > tmp_test.c
-
--- a/tests/scc/execute/include/0062-include.h
+++ /dev/null
@@ -1,5 +1,0 @@
-#include "0062-include2.h"
-
-int
-main()
-{
--- a/tests/scc/execute/include/0062-include2.h
+++ /dev/null
@@ -1,2 +1,0 @@
-int x;
-
--- a/tests/scc/execute/scc-tests.lst
+++ /dev/null
@@ -1,174 +1,0 @@
-0001-sanity.c
-0002-expr.c
-0003-local.c
-0004-pointer.c
-0005-ifstmt.c
-0006-whilestmt.c
-0007-forstmt.c
-0008-dowhilestmt.c
-0009-expr.c
-0010-goto.c
-0011-assign.c
-0012-expr.c
-0013-addridx.c
-0014-assignidx.c
-0015-localarray.c
-0016-addrarray.c
-0017-struct.c
-0018-structptr.c
-0019-selfrefstruct.c
-0020-ptrptr.c
-0021-intfunc.c
-0022-typedef.c
-0023-global.c
-0024-typedefstruct.c
-0025-string.c
-0026-implicitret.c
-0027-charval.c
-0028-bor.c
-0029-band.c
-0030-bxor.c
-0031-relop.c
-0032-indec.c
-0033-ptrindec.c
-0034-logandor.c
-0035-breakcont.c
-0036-notneg.c
-0037-assignop.c
-0038-ptradd.c
-0039-sizeof.c
-0040-cast.c
-0041-queen.c
-0042-prime.c
-0043-union.c
-0044-struct.c
-0045-struct.c
-0046-inits.c
-0048-inits.c
-0049-inits.c
-0050-inits.c
-0052-switch.c
-0053-struct.c
-0054-struct.c
-0055-enum.c
-0056-enum.c
-0057-duff.c
-0058-bug.c
-0059-multistring.c
-0060-charlit.c
-0061-comments.c
-0062-include.c
-0063-define.c
-0064-sysinclude.c
-0065-ifdef.c
-0066-cppelse.c
-0067-define.c
-0068-funclikemacro.c
-0069-funclikemacro.c
-0070-cppif.c
-0071-cppelif.c
-0072-cppelif.c
-0073-ifndef.c
-0074-undef.c
-0075-ptraddasn.c
-0076-ptrsubasn.c
-0077-defined.c
-0078-dirifexpr.c
-0079-cond.c
-0080-arrays.c
-0081-calls.c
-0082-bug.c
-0083-voidret.c
-0084-longlong.c
-0085-ulonglong.c
-0089-short.c
-0090-fptr.c
-0091-fptr.c
-0092-fptr.c
-0093-arrayinit.c
-0094-arrayinit.c [TODO]
-0095-arrayselector.c
-0096-inferredarraysize.c
-0097-extern.c
-0098-tentative.c [TODO]
-0099-tentative.c [TODO]
-0102-bug.c
-0103-voidparm.c
-0104-qbebug.c
-0105-shl.c
-0106-ppcast.c
-0107-bnot.c
-0108-bug.c
-0109-struct.c
-0110-typedefcast.c
-0111-doubledef.c
-0112-cond.c
-0113-externredecl.c
-0114-shortassig.c [TODO]
-0115-null-comparision.c
-0116-floatcmp.c [TODO]
-0117-pointarith.c
-0118-voidmain.c [TODO]
-0119-macrostr.c
-0120-funpar.c
-0121-localinit.c [TODO]
-0122-localinit.c [TODO]
-0123-doubleconst.c [TODO]
-0124-enumstruct.c [TODO]
-0125-fundcl.c
-0126-macropar.c [TODO]
-0127-doublecte.c [TODO]
-0128-kr_names.c
-0129-initi.c [TODO]
-0130-mulpars.c
-0131-hello.c [TODO]
-0132-forward.c [TODO]
-0133-ftn-ptr.c [TODO]
-0134-arith.c [TODO]
-0135-unary.c
-0136-if.c
-0137-int-cast.c [TODO]
-0138-namespace.c
-0139-ptr-ary.c [TODO]
-0140-int-fold.c [TODO]
-0141-int-iden.c [TODO]
-0142-char-const.c [TODO]
-0143-int-const.c
-0144-long-const.c
-0145-llong-const.c [TODO]
-0146-ifdef.c
-0147-intern-cpp.c
-0148-cpp-string.c
-0149-define.c
-0150-define.c
-0151-vararg.c [TODO]
-0152-cat.c
-0153-cpp-string.c [TODO]
-0154-if-defined [TODO]
-0155-struct-compl.c [TODO]
-0156-duff2.c [TODO]
-0157-list.c [TODO]
-0158-ternary.c [TODO]
-0159-typedef.c [TODO]
-0160-cpp-if.c [TODO]
-0161-struct.c [TODO]
-0162-array.c
-0163-array.c [TODO]
-0164-struct.c [TODO]
-0165-struct.c [TODO]
-0166-desig.c [TODO]
-0167-array.c [TODO]
-0168-array.c [TODO]
-0169-string.c [TODO]
-0170-line.c [TODO]
-0171-macros.c [TODO]
-0172-hexa.c
-0173-macro.c
-0174-decay.c [TODO]
-0175-defined.c
-0176-macro.c [TODO]
-0177-literal.c [TODO]
-0178-include.c [TODO]
-0179-sizeof.c [TODO]
-0180-incomplete.c
-0181-stringize.c [TODO]
--- a/tests/scc/execute/sysinclude/0064-sysinclude.h
+++ /dev/null
@@ -1,4 +1,0 @@
-#include "0064-sysinclude2.h"
-
-int x = 2;
-
--- a/tests/scc/execute/sysinclude/0064-sysinclude2.h
+++ /dev/null
@@ -1,1 +1,0 @@
-int y = 2;