From becedfbfdbd9dee77825ff245f48c0acc9d03252 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 13 Mar 2014 10:53:49 +0000 Subject: Bug 695058: force correct struct ref_s size On compilers that tightly pack structures (i.e. don't pad to alignment boundaries), struct ref_s could end up as 14 bytes instead of 16 bytes, thus breaking requirement in the garbage collector. This is less than ideal, and would be better achieved using the same trick we use for the alignment of obj_header_s in base/gxobj.h, linking the structure size to the obj_align_mod, but as on the majority of systems struct ref_s is already 16 bytes, that results in a zero byte array which notable compilers (at least MSVC, and probably others) to error. No cluster differences, --- gs/psi/iref.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gs/psi/iref.h b/gs/psi/iref.h index 030178f1a..ac0660a85 100644 --- a/gs/psi/iref.h +++ b/gs/psi/iref.h @@ -421,9 +421,14 @@ typedef int (*op_proc_t)(i_ctx_t *i_ctx_p); * Note that because of the way packed arrays are represented, * the type_attrs member must be the first one in the ref structure. */ + /* The _pad entry ensures that the struct ref_s is the required size + * (16 bytes) even with compilers that tightly pack structures - the + * size requirement is imposed by the garbarge collector + */ struct tas_s { /* type_attrs is a single element for fast dispatching in the interpreter */ ushort type_attrs; + ushort _pad; uint32_t rsize; }; struct ref_s { -- cgit v1.2.1