[Mono-dev] Unwanted freeing of generic types
Neale Ferguson
neale at sinenomine.net
Thu Aug 17 20:54:37 UTC 2017
In threads.c we defined SpecialStaticOffset:
typedef union {
struct {
#if G_BYTE_ORDER != G_LITTLE_ENDIAN
guint32 type : 1;
guint32 offset : 25;
guint32 index : 6;
#else
guint32 index : 6;
guint32 offset : 25;
guint32 type : 1;
#endif
} fields;
guint32 raw;
} SpecialStaticOffset;
However, the MAKE_SPECIAL_STATIC_OFFSET macro assumes little endian:
#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
((SpecialStaticOffset) { .fields = { (type), (offset), (index) } }.raw)
Therefore the offset value that was being returned was incorrect and we'd choose the wrong bitset. To fix this:
#if G_BYTE_ORDER != G_LITTLE_ENDIAN
#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
((SpecialStaticOffset) { .fields = { (type), (offset), (index) } }.raw)
#else
#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
((SpecialStaticOffset) { .fields = { (index), (offset), (type) } }.raw)
#endif
Making this change results in the failing (crashing) test - generics-special2.2 - to work as it should.
Neale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20170817/e7def0d4/attachment.html>
More information about the Mono-devel-list
mailing list