summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gc.c3
-rw-r--r--src/string.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/gc.c b/src/gc.c
index 64e0b3eae..be812c4d3 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1619,6 +1619,9 @@ mrb_init_gc(mrb_state *mrb)
{
struct RClass *gc;
+ mrb_static_assert(sizeof(RVALUE) <= sizeof(void*) * 6,
+ "RVALUE size must be within 6 words");
+
gc = mrb_define_module(mrb, "GC");
mrb_define_class_method(mrb, gc, "start", gc_start, MRB_ARGS_NONE());
diff --git a/src/string.c b/src/string.c
index e8f81c0ae..78c41c5f3 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2926,6 +2926,9 @@ mrb_init_string(mrb_state *mrb)
{
struct RClass *s;
+ mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << MRB_STR_EMBED_LEN_BIT),
+ "pointer size too big for embedded string");
+
mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */
MRB_SET_INSTANCE_TT(s, MRB_TT_STRING);