diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-16 13:17:37 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-16 13:17:37 -0800 |
commit | 41675a7501a7d6b07f1c4a8045209ec96e9507bd (patch) | |
tree | e7131dff13e6d3f42d0897670b02597127cbaffc /tests | |
parent | 0d1f0bde195e0f58f017b2dd2ab694036843d64a (diff) |
strengthen test_alloca to check alignment
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_alloca.in | 13 | ||||
-rw-r--r-- | tests/test_core.py | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/core/test_alloca.in b/tests/core/test_alloca.in index bfad3324..d115880f 100644 --- a/tests/core/test_alloca.in +++ b/tests/core/test_alloca.in @@ -1,9 +1,14 @@ #include <stdio.h> #include <stdlib.h> +#include <assert.h> -int main() { - char *pc; - pc = (char *)alloca(5); - printf("z:%d*%d*\n", pc > 0, (int)pc); +int main(int argc, char **argv) { + char *pc, *pc2; + assert(argc == 1); + pc = (char *)alloca(4+argc); + assert(((int)pc) % 4 == 0); + pc2 = (char *)alloca(4+argc); + assert(((int)pc2) % 4 == 0); + printf("z:%d*%d*%d*\n", pc > 0, (int)pc, (int)pc2); return 0; } diff --git a/tests/test_core.py b/tests/test_core.py index ce778209..59f2f9e9 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1606,6 +1606,8 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co self.do_run_from_file(src, output) def test_alloca(self): + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('non-ta2 may have unaligned allocas') + test_path = path_from_root('tests', 'core', 'test_alloca') src, output = (test_path + s for s in ('.in', '.out')) |