Add a terminator to the domain_state
On a 32-bits architecture, if the last member of the caml_domain_state is a pointer, it will be 4-bytes long, and the struct will end after a 4 bytes boundary, failing the assertion. As @xavierleroy [put it][1]: > we don't care about the total size of the struct, but we care that > the members before `end_of_domain_state` are spaced by 8. [1]: https://github.com/ocaml/ocaml/issues/9714#issuecomment-650516382 See #9714.master
parent
4d6d422867
commit
cba42a3ba3
|
@ -33,6 +33,7 @@ typedef struct {
|
|||
#endif
|
||||
#include "domain_state.tbl"
|
||||
#undef DOMAIN_STATE
|
||||
CAMLalign(8) char end_of_domain_state;
|
||||
} caml_domain_state;
|
||||
|
||||
enum {
|
||||
|
@ -45,9 +46,8 @@ enum {
|
|||
/* Check that the structure was laid out without padding,
|
||||
since the runtime assumes this in computing offsets */
|
||||
CAML_STATIC_ASSERT(
|
||||
sizeof(caml_domain_state) ==
|
||||
(Domain_state_num_fields
|
||||
) * 8);
|
||||
offsetof(caml_domain_state, end_of_domain_state) ==
|
||||
Domain_state_num_fields * 8);
|
||||
|
||||
CAMLextern caml_domain_state* Caml_state;
|
||||
#ifdef CAML_NAME_SPACE
|
||||
|
|
Loading…
Reference in New Issue