strengthen test_alloca to check alignment
This commit is contained in:
Родитель
0d1f0bde19
Коммит
41675a7501
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче