@ch3root Are you sure? I think the code has UB. Does p1==p2 evaluating true imply they are the same/interchangeable?
@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 -
-
-
@RichFelker@ch3root It's going to be allowed in practice if it comes from scanf since it can't track the origin of the pointer. -
@RichFelker@ch3root But it still seems technically wrong per their interpretation if it was calculated from a different object. -
@CopperheadSec@ch3root It's wrong and inconsistent for integers to carry any notion of "calculated from". -
@RichFelker@ch3root The standard doesn't directly allow it but their rationale is that it's allowed under the as-if rule. -
@RichFelker@ch3root i.e. if all other rules of the standard are followed, then this Clang/GCC rule is implicitly followed too. -
@CopperheadSec@ch3root But its not. The rules about integer to pointer conversions and uintptr_t are not respected by this. -
@RichFelker@ch3root The logic is that valid code constructing a pointer this way must derive it from an existing pointer in practice. -
@RichFelker@ch3root It might not be true though... one example is the incorrect __attribute__((malloc)) on strdup in glibc. - 7 more replies
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.