aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/libgccjit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/jit/libgccjit.c')
-rw-r--r--gcc/jit/libgccjit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index 4d7dd8c..85d9f62 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -543,6 +543,11 @@ gcc_jit_context_new_field (gcc_jit_context *ctxt,
/* LOC can be NULL. */
RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type");
RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name");
+ RETURN_NULL_IF_FAIL_PRINTF1 (
+ type->has_known_size (),
+ ctxt, loc,
+ "type has unknown size (type: %s)",
+ type->get_debug_string ());
return (gcc_jit_field *)ctxt->new_field (loc, type, name);
}
@@ -1033,6 +1038,11 @@ gcc_jit_context_new_global (gcc_jit_context *ctxt,
kind);
RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type");
RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name");
+ RETURN_NULL_IF_FAIL_PRINTF1 (
+ type->has_known_size (),
+ ctxt, loc,
+ "type has unknown size (type: %s)",
+ type->get_debug_string ());
return (gcc_jit_lvalue *)ctxt->new_global (loc, kind, type, name);
}
@@ -1829,6 +1839,11 @@ gcc_jit_function_new_local (gcc_jit_function *func,
"Cannot add locals to an imported function");
RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type");
RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name");
+ RETURN_NULL_IF_FAIL_PRINTF1 (
+ type->has_known_size (),
+ ctxt, loc,
+ "type has unknown size (type: %s)",
+ type->get_debug_string ());
return (gcc_jit_lvalue *)func->new_local (loc, type, name);
}