Loading libacc/acc.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -4131,9 +4131,10 @@ class Compiler : public ErrorSink { if (a && level > 8) { a = pGen->gtst(t == OP_LOGICAL_OR, a); pGen->li(t != OP_LOGICAL_OR); pGen->gjmp(5); /* jmp $ + 5 (sizeof li, FIXME for ARM) */ int b = pGen->gjmp(0); pGen->gsym(a); pGen->li(t == OP_LOGICAL_OR); pGen->gsym(b); } } } Loading libacc/tests/data/film.c 0 → 100644 +53 −0 Original line number Diff line number Diff line // Test logical and bitwise AND and OR int test(int x, int y) { int v = x || y; return v; } int test2(int x, int y) { if(x | y) { return 1; } else { return 0; } } int test3(int x, int y) { int v = x && y; return v; } int test4(int x, int y) { if(x & y) { return 1; } else { return 0; } } int main(int index) { int x,y; printf("testing...\n"); int totalBad = 0; for(y = 0; y < 2; y++) { for(x = 0; x < 2; x++) { int a = test(x,y); int b = test2(x,y); if (a != b) { printf("Results differ: OR x=%d y=%d a=%d b=%d\n", x, y, a, b); totalBad++; } a = test3(x,y); b = test4(x,y); if (a != b) { printf("Results differ: AND x=%d y=%d a=%d b=%d\n", x, y, a, b); totalBad++; } } } printf("Total bad: %d\n", totalBad); return 0; } libacc/tests/test.py +5 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,11 @@ result: 0""", """Literals: 1 -1 0 """) def testFilm (self): self.compileCheck(["-R", "data/film.c"], """Executing compiled code: result: 0""", """testing... Total bad: 0 """) if __name__ == '__main__': if not outputCanRun(): print "Many tests are expected to fail, because acc is not a 32-bit x86 Linux executable." Loading Loading
libacc/acc.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -4131,9 +4131,10 @@ class Compiler : public ErrorSink { if (a && level > 8) { a = pGen->gtst(t == OP_LOGICAL_OR, a); pGen->li(t != OP_LOGICAL_OR); pGen->gjmp(5); /* jmp $ + 5 (sizeof li, FIXME for ARM) */ int b = pGen->gjmp(0); pGen->gsym(a); pGen->li(t == OP_LOGICAL_OR); pGen->gsym(b); } } } Loading
libacc/tests/data/film.c 0 → 100644 +53 −0 Original line number Diff line number Diff line // Test logical and bitwise AND and OR int test(int x, int y) { int v = x || y; return v; } int test2(int x, int y) { if(x | y) { return 1; } else { return 0; } } int test3(int x, int y) { int v = x && y; return v; } int test4(int x, int y) { if(x & y) { return 1; } else { return 0; } } int main(int index) { int x,y; printf("testing...\n"); int totalBad = 0; for(y = 0; y < 2; y++) { for(x = 0; x < 2; x++) { int a = test(x,y); int b = test2(x,y); if (a != b) { printf("Results differ: OR x=%d y=%d a=%d b=%d\n", x, y, a, b); totalBad++; } a = test3(x,y); b = test4(x,y); if (a != b) { printf("Results differ: AND x=%d y=%d a=%d b=%d\n", x, y, a, b); totalBad++; } } } printf("Total bad: %d\n", totalBad); return 0; }
libacc/tests/test.py +5 −0 Original line number Diff line number Diff line Loading @@ -324,6 +324,11 @@ result: 0""", """Literals: 1 -1 0 """) def testFilm (self): self.compileCheck(["-R", "data/film.c"], """Executing compiled code: result: 0""", """testing... Total bad: 0 """) if __name__ == '__main__': if not outputCanRun(): print "Many tests are expected to fail, because acc is not a 32-bit x86 Linux executable." Loading