News for hackers. Stuff that matters.
Re:“What the Hardware Does” Is Not What Your Program Does: U... by steveklabnik on Sunday July 14, 2019 @05:14PM (#20436083)
> At the end of the day, assembly code is going to execute, and that assembly code is going to (despite the authors protestations to the contrary) have well defined memory of one value or another.

The point is that you may not get the assembly you assume you’re going to get. Like the example shows, it may never even generate something that accesses the value at all.

Re:“What the Hardware Does” Is Not What Your Program Does: U... by archgoon on Sunday July 14, 2019 @05:19PM (#20436111)
Yes, but that doesn't mean that what the hardware does is irrelevant.
Re:“What the Hardware Does” Is Not What Your Program Does: U... by steveklabnik on Sunday July 14, 2019 @05:25PM (#20436152)
That’s true. You have to understand that abstract machine, what it guarantees, and how that relates to your hardware and what it guarantees.

I really need to finish my own blog post series on this topic...

Re:“What the Hardware Does” Is Not What Your Program Does: U... by archgoon on Monday July 15, 2019 @03:14AM (#20438757)
Guess there's some bigger context that I'm missing here. I wouldn't have expected saying "Understanding how your compiler enforces it's abstract machine is beneficial" would be a controversial position to take.
Re:“What the Hardware Does” Is Not What Your Program Does: U... by ralfjung on Monday July 15, 2019 @07:36AM (#20439819)
> Understanding how your compiler enforces it's abstract machine is beneficial

The compiler does not enforce it though. It only implements the abstract machine, and the implementation is only correct for UB-free programs.

Re:“What the Hardware Does” Is Not What Your Program Does: U... by archgoon on Monday July 15, 2019 @11:22AM (#20441647)
When you are in UB it's even more interesting to ask what the hardware actually does because the standard will not specify anything.
Re:“What the Hardware Does” Is Not What Your Program Does: U... by Rusky on Monday July 15, 2019 @02:50PM (#20443885)
No, that's when it's least interesting to ask what the hardware does. A program with UB will not reliably compile to any particular hardware behavior, so changing unrelated parts of the program or upgrading your compiler can change which hardware behavior you get.

The actual hardware behavior is useful for other purposes, like understanding why the abstract machine is the way it is, or understanding and improving the performance of well-defined programs, but it is not useful at all once you have UB.

Re:“What the Hardware Does” Is Not What Your Program Does: U... by archgoon on Monday July 15, 2019 @04:23PM (#20444847)
It's interesting to me, and it's interesting to the first person in this thread. I'm sorry that you feel that were wasting our time.