summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2014-03-13 10:53:49 +0000
committerChris Liddell <chris.liddell@artifex.com>2014-03-13 11:01:55 +0000
commitbecedfbfdbd9dee77825ff245f48c0acc9d03252 (patch)
tree36f7e49e952f3162ebd4d2169ad4ee95f2e11acf
parentfdaa74efeebb753db1855eaf6a3a824ecbf1231e (diff)
downloadghostpdl-becedfbfdbd9dee77825ff245f48c0acc9d03252.tar.gz
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,
-rw-r--r--gs/psi/iref.h5
1 files changed, 5 insertions, 0 deletions
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 {