From 6b5e0bd98c3a807ab7708e775ac9b60a4f59e427 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 14 Jan 2018 11:19:18 +0000 Subject: exclude flexible array size with old compilers git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index 57ff506d0a..20ad68e65e 100644 --- a/iseq.c +++ b/iseq.c @@ -208,7 +208,7 @@ iseq_memsize(const rb_iseq_t *iseq) cur = compile_data->storage_head; while (cur) { - size += cur->size + sizeof(struct iseq_compile_data_storage); + size += cur->size + offsetof(struct iseq_compile_data_storage, buff); cur = cur->next; } } @@ -333,7 +333,7 @@ prepare_iseq_build(rb_iseq_t *iseq, ISEQ_COMPILE_DATA(iseq)->storage_head = ISEQ_COMPILE_DATA(iseq)->storage_current = (struct iseq_compile_data_storage *) ALLOC_N(char, INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE + - sizeof(struct iseq_compile_data_storage)); + offsetof(struct iseq_compile_data_storage, buff)); RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->catch_table_ary, rb_ary_tmp_new(3)); ISEQ_COMPILE_DATA(iseq)->storage_head->pos = 0; -- cgit v1.2.3