On Monday, 18 September 2017 at 02:04:49 UTC, bitwise wrote:
The following code will run fine on Windows, but crash on iOS due to the misaligned access:
Interesting, does iOS crash such a process intentionally, or is it a side effect?
char data[8]; int i = 0xFFFFFFFF; int* p = (int*)&data[1];
Isn't this already undefined behaviour (6.3.2.3 p.7 of C11 [1] - present in earlier versions also, IIRC)?
*p++ = i; *p++ = i; *p++ = i;
The last of these is also a buffer overflow. [1] http://iso-9899.info/n1570.html