ron(a)ronnatalie.com wrote in <1f6201d43bb7$3b9ebde0$b2dc39a0$(a)ronnatalie.com>:
|That's a different issue (as I alluded to in my post). Alignment on
|machines is a different problem. Type "punning" isn't the problem, the
|compiler is propely converting one
|pointer type to another but the operand is not correctly aligned.
The story told here is more about how the peculiarities of
a standard text and compiler developers come together to something
very unfortunate.
|In the case I'm referring to, the Univac and the HEP encode partial word
|sizes in the pointer. If you take the literal bits from one pointer to
|another (as if you stored it in a union),
|then you end up referring to the wrong sized operand in the subsequent
|operation. Had you converted it to void* or explicitly forced a
Ah, i am sorry. Indeed i misunderstood that.
|conversion wih the cast, the compiler
|would have taken care of converting the pointer for you.
Though even more unfortunate i am, since this union trick is often
the only way to be able to do proper a.k.a. allowed type
conversion, where the standard text forbids something quick and
easy, casting of or to function pointers in C++ comes to mind
spontaneously. (The linked story also tries to go via (char*) to
a desired type, but the compiler seems to be too neat. And even
if this is a bug, of course...)
|It's very odd when you find the machine storing the WRONG SIZE operand from
|the pointer type in use.
|As I said, it wasn't hard to fix (just grep for all the afflicted unions),
|but it took a bit of long kernel debug sessions to figure out what was
|happening.
|
|> -----Original Message-----
|> From: Steffen Nurpmeso <steffen(a)sdaoden.eu>
|> I have found the link in the history of my browser, the story was
|>
|>
http://pzemtsov.github.io/2016/11/06/bug-story-alignment-on-x86.html
--End of <1f6201d43bb7$3b9ebde0$b2dc39a0$(a)ronnatalie.com>
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)