summaryrefslogtreecommitdiffstats
path: root/libacc/tests/data/otcc-ansi.c
diff options
context:
space:
mode:
Diffstat (limited to 'libacc/tests/data/otcc-ansi.c')
-rw-r--r--libacc/tests/data/otcc-ansi.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/libacc/tests/data/otcc-ansi.c b/libacc/tests/data/otcc-ansi.c
index 069514b..72580e9 100644
--- a/libacc/tests/data/otcc-ansi.c
+++ b/libacc/tests/data/otcc-ansi.c
@@ -50,7 +50,7 @@ void ad() {
o();
}
C = 0;
- d = h;
+ d = h;
if (X()) {
E(32);
M = D;
@@ -162,7 +162,7 @@ void Z(int e) {
void N(int j, int e) {
ae(j + 131);
- s((e < 512) << 7 | 5, e);
+ s((e > -512 && e < 512) << 7 | 5, e);
}
void T (int j) {
@@ -404,7 +404,7 @@ void ab (int j) {
v=v +4;
}
ad();
- if( d == 44)ad();
+ if( d == 44)ad() ;
}
ad();
}
@@ -432,11 +432,20 @@ void ab (int j) {
}
}
+int run(int g, int e) {
+ return (*(int(*)()) *(int*) (P + 592))(g, e);
+}
+
int main(int g, int e) {
+ int result;
Q = stdin;
if (g-- > 1) {
e = e + 4;
Q = fopen(*(int*) e, "r");
+ if (!Q) {
+ fprintf(stderr, "otcc-ansi.c: could not open file %s\n", *(int*) e);
+ return -2;
+ }
}
D = strcpy(R = calloc(1, 99999), " int if else while break return for define main ") + 48;
v = calloc(1, 99999);
@@ -445,5 +454,13 @@ int main(int g, int e) {
o();
ad();
ab(0);
- return (*(int(*)()) *(int*) (P + 592))(g, e);
+ if (mprotect(ac & (~ 4095), (99999 + 4095) & (~ 4095), 7)) {
+ printf("Mprotect failed. %d\n", errno);
+ return -1;
+ }
+ fprintf(stderr, "otcc-ansi.c: About to execute compiled code:\n");
+ result = run(g, e);
+ fprintf(stderr, "atcc-ansi.c: result: %d\n", result);
+ return result;
}
+