[TUHS] C++ / Kernel

ron at ronnatalie.com ron at ronnatalie.com
Sat Aug 25 00:32:05 AEST 2018


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.   

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
conversion wih the cast, the compiler 
would have taken care of converting the pointer for you.

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 at 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
> 






More information about the TUHS mailing list