Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The author clearly states that restrict is a promise, and then immediately violates that promise

Which part of the program do you believe violates the restrict promise?

I think it's not obvious that it is violated. The question is whether a pointer obtained through an integer round trip is considered to be derived from the original pointer. The author assumes that it is.



> Which part of the program do you believe violates the restrict promise?

The part where they modify a piece of memory using `x` and then modify the same piece using `y`.

That's a promise the programmer made inside that function and for anyone else who calls the function. This is C, so it's not the compiler's job to prove the implementer or caller got it right.


But it's never modified using y?


I see your point, but this is really niddly. It explicitly asks if the address in `x` is equal to the address in `y-1`. And if so, it modifies the contents at that address which is equal to both.

If the conclusion was that the C standard could/should tighten up its verbiage for cases like this, I'd agree. But the conclusion is something about adding provenance to integers...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: