Isn't also TYPE_SUBTYPE wrong in the big endian case? It seems to me that on a 64bit big endian machine both subtype and type would always end up being 0.
like so?
#define TYPE_SUBTYPE(X,Y) (((Y)|((X)<<16)) << (sizeof(ptrdiff_t) - 32))
Arne
On Tue, 24 Jun 2014, Arne Goedeke wrote:
The casting through union is strictly still undefined but it works in gcc. Unfortunately, that is not the case for all compilers. Apparently Sun CC will not generate the intended code. See:
http://blog.qt.digia.com/blog/2011/06/10/type-punning-and-strict-aliasing/
A simpler solution, which doesnt need any changes to the svalue struct would have been to do the write using memcpy, which would be optimized into one pointer size store. It is defined behavior which reflects the aliasing correctly and requires only minimal modification to the original code.
Arne
On Wed, 25 Jun 2014, Chris Angelico wrote:
On Tue, Jun 24, 2014 at 7:54 PM, Chris Angelico rosuav@gmail.com wrote:
I'm starting up a completely fresh Pike clone to see if somehow I've accumulated cruft of some sort. If that behaves differently, I'll let you know.
That didn't solve anything, but the latest commit on 8.0 branch did. Thanks Grubba! Looking good.
ChrisA