diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-23 15:43:01 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-23 15:43:01 -0800 |
commit | b86abc2ecfea9ccbb93cad2fe4e9f8574beb7ed8 (patch) | |
tree | e966f2fd2bc38d15c18fa880098ba5c8b91f07eb /tests/core | |
parent | 9b3e1b8d8e948709a9df1a23ea8790c93eb5b82e (diff) |
fix bug where close-together tempDoublePtr operations could cross each other
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/closebitcasts.c | 32 | ||||
-rw-r--r-- | tests/core/closebitcasts.txt | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/core/closebitcasts.c b/tests/core/closebitcasts.c new file mode 100644 index 00000000..2c9d5ab5 --- /dev/null +++ b/tests/core/closebitcasts.c @@ -0,0 +1,32 @@ +#include <stdio.h> + +int main(int argc, char **argv) { + float x = argc%17, y = (argc+1)*(argc+2)*(argc+3)*(argc+4)*(argc*5); + y *= 1<<30; + y *= -13; + if (argc == 17) { x++; y--; } + int *xi = (int*)&x; + int *yi = (int*)&y; + int z = *xi - *yi; + while (z % 15) { + z++; + } + printf("!%d\n", z); + + double xd = x, yd = y; + yd = yd*yd; + yd = yd*yd; + int *xl = (int*)&xd; + int *xh = &((int*)&xd)[1]; + int *yl = (int*)&yd; + int *yh = &((int*)&yd)[1]; + int l = *xl - *yl; + int h = *xh - *yh; + while (l % 15) { + l++; + h += 3; + } + printf("%d,%d!\n", l, h); + return 0; +} + diff --git a/tests/core/closebitcasts.txt b/tests/core/closebitcasts.txt new file mode 100644 index 00000000..f97366cd --- /dev/null +++ b/tests/core/closebitcasts.txt @@ -0,0 +1,2 @@ +!1787576325 +589815810,-179981561! |