News for hackers. Stuff that matters.
Re:Everything in C is undefined behavior by saagarjha on Wednesday May 20, 2026 @07:31AM (#48206064)
Usually this is not the case.
Re:Everything in C is undefined behavior by tialaramex on Wednesday May 20, 2026 @10:00AM (#48207948)
Indeed one of the fun LLVM bugs is that it can arrive at a situation in which it believes pointer A and pointer B are definitely not equal (weird given what's about to happen but OK that's potentially fine...) then we ask for their addresses† as integers X and Y, LLVM insists those integers aren't equal either because the pointers weren't (which as we're about to see is wrong) and then we subtract X - Y or Y - X and the answer either way is zero. Awkward. The integers were definitely equal.

† Although on a real modern CPU the pointer "is" just an address, notionally it has three components, the address, an address space (modern machines typically only have one) and a "provenance".