Add support for "short" data type.
diff --git a/libacc/tests/data/short.c b/libacc/tests/data/short.c
new file mode 100644
index 0000000..5e222f3
--- /dev/null
+++ b/libacc/tests/data/short.c
@@ -0,0 +1,6 @@
+short a = 3;
+int main() {
+ short* b = &a;
+ *b = *b - 5;
+ return a;
+}
diff --git a/libacc/tests/runtimeTest.cpp b/libacc/tests/runtimeTest.cpp
index d59e1d1..55bf877 100644
--- a/libacc/tests/runtimeTest.cpp
+++ b/libacc/tests/runtimeTest.cpp
@@ -30,6 +30,8 @@
extern "C"
void accDisassemble(ACCscript* script);
+int globalVar;
+
void op_int(int a) {
printf("op_int(%d)\n", a);
}
@@ -46,6 +48,7 @@
" float e, float f, float g, float h,\n"
" float i, float j, float k, float l);\n"
"void script() {\n"
+ " globalVar += 3;\n"
" op_int(123);\n"
" op_float12(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0);\n"
"}\n";
@@ -57,6 +60,9 @@
if (strcmp("op_float12", name) == 0) {
return (ACCvoid*) op_float12;
}
+ if (strcmp("globalVar", name) == 0) {
+ return (ACCvoid*) &globalVar;
+ }
return (ACCvoid*) dlsym(RTLD_DEFAULT, name);
}
@@ -98,7 +104,9 @@
fprintf(stderr, "Could not find script: %d\n", result);
} else {
fprintf(stderr, "Executing script:\n");
+ globalVar = 17;
run(scriptPointer);
+ fprintf(stderr, "After script globalVar = %d\n", globalVar);
}
diff --git a/libacc/tests/test.py b/libacc/tests/test.py
index 7bcbdd4..a3114ad 100644
--- a/libacc/tests/test.py
+++ b/libacc/tests/test.py
@@ -382,6 +382,11 @@
result: 0
""","""""")
+ def testShort(self):
+ self.compileCheck(["-R", "data/short.c"], """Executing compiled code:
+result: -2
+""","""""")
+
if __name__ == '__main__':
if not outputCanRun():
print "Many tests are expected to fail, because acc is not a 32-bit x86 Linux executable."