int a[20], b[20], *p = a, i; if ((uintptr_t)(a + 20) == (uintptr_t)b) { b[5] = 1; for (i = 0; i < 40; i++) *p++ = 0; printf("%d\n", b[5]); }
@CopperheadSec @ch3root Integrrs don't have "memory" of where they came from. Imagine printf, user types it back, scanf.
-
-
@RichFelker@ch3root That's undefined under the interpretation of the C standard used by GCC and LLVM. -
@CopperheadSec@ch3root If so their models are inconsistent with the standard. -
@RichFelker@ch3root This interpretation is based on rules involving things like aliasing rather than integer -> pointer casts themselves. -
@CopperheadSec@ch3root It's still wrong. printf 2 equal-as-uintptr_t ptrs. User types one back in. Which object is it allowed to access? -
@RichFelker@CopperheadSec Yes, this is one to strip history. Another one is pass it through a volatile variable. -
@RichFelker@CopperheadSec If a compiler cannot "see" history it has to be cautious. The problem is when it can see it.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.