aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-14 21:38:27 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-14 21:38:27 -0400
commita76558db26ea175504830ae4aa840a1aa82b16d0 (patch)
tree77557c27d4ab823654a5403ce8d69ea6d0e49408 /test
parent7bc0145b802002c38a409dd9fe0b297c8af82391 (diff)
downloadzig-a76558db26ea175504830ae4aa840a1aa82b16d0.tar.gz
zig-a76558db26ea175504830ae4aa840a1aa82b16d0.zip
fix behavior with reinterpreting constant memory
Diffstat (limited to 'test')
-rw-r--r--test/cases/cast.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/cases/cast.zig b/test/cases/cast.zig
index 3ab5834d4f..a7bef9ded5 100644
--- a/test/cases/cast.zig
+++ b/test/cases/cast.zig
@@ -15,3 +15,13 @@ fn numLitIntToPtrCast() {
const vga_mem = (&u16)(0xB8000);
assert(usize(vga_mem) == 0xB8000);
}
+
+fn pointerReinterpretConstFloatToInt() {
+ @setFnTest(this);
+
+ const float: f64 = 5.99999999999994648725e-01;
+ const float_ptr = &float;
+ const int_ptr = (&i32)(float_ptr);
+ const int_val = *int_ptr;
+ assert(int_val == 858993411);
+}