aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-08-04 09:06:11 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-08-04 09:06:11 -0700
commit6a46d74b73ea522dbf6e96710aaf6fff4b5b7add (patch)
treeb07bce012d1c2966ef15715ade043ab1430cb05a
parenta470f753c33833c6c04293e42f8eee2208fcd2d4 (diff)
make test_unaligned more robust
-rwxr-xr-xtests/runner.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py
index d859bfe1..c6c7cb2c 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1043,8 +1043,15 @@ c5,de,15,8a
};
int main() {
- // the 64-bit value here will not always be 8-byte aligned
- S s[3] = { {0x12a751f430142, 22}, {0x17a5c85bad144, 98}, {1, 1}};
+ // the 64-bit value here will not be 8-byte aligned
+ S s0[3] = { {0x12a751f430142, 22}, {0x17a5c85bad144, 98}, {1, 1}};
+ char buffer[10*sizeof(S)];
+ int b = int(buffer);
+ S *s = (S*)(b + 4-b%8);
+ s[0] = s0[0];
+ s[1] = s0[1];
+ s[2] = s0[2];
+
printf("*%d : %d : %d\n", sizeof(S), ((unsigned int)&s[0]) % 8 != ((unsigned int)&s[1]) % 8,
((unsigned int)&s[1]) - ((unsigned int)&s[0]));
s[0].x++;