Skip to content

Commit f51b397

Browse files
authored
[mono] Handle enum return type when inlining CreateInstance (#91008)
Use underlying base type when deciding how to inline a CreateInstance invocation in mini_emit_inst_for_method. Fixes #90292 (Mono abort causing .NET 8 msbuild regression).
1 parent 67e2eca commit f51b397

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mono/mono/mini/intrinsics.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,9 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
20792079
MonoType *t = method_context->method_inst->type_argv [0];
20802080
MonoClass *arg0 = mono_class_from_mono_type_internal (t);
20812081
if (m_class_is_valuetype (arg0) && !mono_class_has_default_constructor (arg0, FALSE)) {
2082-
if (m_class_is_primitive (arg0)) {
2082+
if (m_class_is_primitive (arg0) || m_class_is_enumtype (arg0)) {
2083+
if (m_class_is_enumtype (arg0))
2084+
t = mono_class_enum_basetype_internal (arg0);
20832085
int dreg = alloc_dreg (cfg, mini_type_to_stack_type (cfg, t));
20842086
mini_emit_init_rvar (cfg, dreg, t);
20852087
ins = cfg->cbb->last_ins;

0 commit comments

Comments
 (0)