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 If the values as uintptr_t are equal, casting back should yield a pointer which could access either object.
-
-
@RichFelker@CopperheadSec This is wrong in practice. gcc tracks pointer's origin through casts to integers (and even floats). -
@ch3root@RichFelker Yes, it's difficult to interpret the standard. But it's objectively true that GCC and LLVM do it this way. -
@CopperheadSec@ch3root Do you have an example to demonstrate the behavior I claim is a bug? -
@RichFelker@CopperheadSec Sure. It's too big for a tweet. Sent by email. -
@ch3root@CopperheadSec Thanks. I think this should be a bug report. -
@RichFelker@CopperheadSec Wait, you said that equality doesn't imply interchangability. What's the problem then? :-) -
@ch3root@CopperheadSec For integers it does. The requirements of an implementation-defined conversion and faithfulness for uintptr_t...
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.