|
|
|
|
|
by micro-ram
2831 days ago
|
|
Agreed. I get the intended result of 7 5 7 on macOS 10.13.6 LLVM. Mac:tmp $ clang -O3 mem1d.c ; ./a.out
diff = -96
x = 0x7f9f4fc00300, *x = 7
y = 0x7f9f4fc00360, *y = 5
p = 0x7f9f4fc00300, *p = 7
Mac:tmp $ diff mem1d.c mem2d.c
13c13
< int *p = (int *)(yi + diff);
---
> int *p = (int *)(yi - 96);
Mac:tmp $ clang -O3 mem2d.c ; ./a.out
diff = -96
x = 0x7fc2b5c00300, *x = 7
y = 0x7fc2b5c00360, *y = 5
p = 0x7fc2b5c00300, *p = 7
Mac:tmp$ clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
|
|