Found return instr that returns non-void in Function of void return type!
ret void undef, !dbg !23
void
*** Unoptimized LLVM IR for HelloWorld.Program:GetS1 () ***
define hidden monocc void @HelloWorld_Program_GetS1() #2 !dbg !4 {
BB0:
%vreg_loc_19 = alloca %S1, align 1, !dbg !8
%vreg_loc_16 = alloca %S1, align 1, !dbg !8
%ret_buf = alloca ptr, align 8, !dbg !8
br label %INIT_BB1, !dbg !8
INIT_BB1: ; preds = %BB0
br label %INITED_BB2, !dbg !8
INITED_BB2: ; preds = %INIT_BB1
br label %BB2, !dbg !8
BB2: ; preds = %INITED_BB2
call void @llvm.memset.p0.i32(ptr %vreg_loc_19, i8 0, i32 0, i1 false), !dbg !9
br label %BB1, !dbg !9
BB1: ; preds = %BB2
call void @llvm.memset.p0.i32(ptr %ret_buf, i8 0, i32 ptrtoint (ptr getelementptr (void, ptr null, i32 1) to i32), i1 false), !dbg !8
call void @llvm.memcpy.p0.p0.i32(ptr %ret_buf, ptr %vreg_loc_19, i32 0, i1 false), !dbg !8
ret void undef, !dbg !8
}
***
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct S1
{
}
namespace HelloWorld
{
internal class Program
{
public static S1 GetS1() => new S1();
private static void Main(string[] args)
{
S1 s1 = GetS1();
}
}
}
Found while fixing #103628
Mono IR:
Steps to reproduce:
Build the following program with mono aot:
Error is most likely caused by wrong logic here
runtime/src/mono/mono/mini/mini-llvm.c
Line 1596 in 15e96fa