Beef icon indicating copy to clipboard operation
Beef copied to clipboard

IDE Crash when returning a struct containing an unknown type in a Result<T>

Open Arrorr opened this issue 4 years ago • 1 comments

The following code crashes the IDE when trying to compile it.

using System;
namespace CrashTest
{
	class Program
        {
		public static void Main()
                {
			var c = scope SomeClass();
			c.CrashFunction();
		}
	}

	public class SomeClass
        {
		public Result<StructWithMissingUsing> CrashFunction()
                {
			return StructWithMissingUsing();
		}
	}


	struct StructWithMissingUsing
        {
		public SomeUnknownType type;
	}
}

OS: Windows 10 IDE: v0.43.0

It gives the following crash message

FATAL ERROR
Failure during codegen of ?CrashFunction@SomeClass@CrashTest@bf@@QEAA?AU?$Result@?AUStructWithMissingUsing@CrashTest@bf@@@System@3@XZ in CrashTest_SomeClass: Unable to find bevalue for operand: _bf.System
 MCBlock: entry:0

Executable: C:\Program Files\BeefLang\bin\BeefIDE.exe

File Version: 0.43.0

Product Version: 59d4e258d5dd71a0cbcfd43cc223ef75fdb71f02


Crash minidump saved as C:\Program Files\BeefLang\bin\CrashDumps\BeefIDE_20210323_175247.dmp
Exception: Breakpoint (code 0x80000003) at address 7ffa'49c84c13 in thread 3188
Logical Address: 0001:'00003c13

90'440fbfe0 7ffa'49c84c13 0001:'00003c13 Beef042RT64.dll
    Params: 90'440fc070 '000000de 1bd'af4afe18 '000000de

90'440fc070 1bd'ad6b7cec IDEHelper64.dll BfpSystem_FatalError+12C
    Params: 90'440fc3c0 90'440fddb0 '00000000 1bd'c53c2b70

90'440fc120 1bd'ad3ec81d IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+24EDD
    Params: '00000000 1bd'af4b00b8 90'440fc188 1bd'ad380000

90'440fc350 1bd'ad3edf32 IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+265F2
    Params: 90'440fcfd0 90'440fc3c0 1bd'c53c2b70 90'440fcf00

90'440fc440 1bd'ad3ef668 IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+27D28
    Params: 1bd'c69ce1a8 90'440fc550 1bd'c69ce120 1bd'c69ce190

90'440fdc20 1bd'ad41726d IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+4F92D
    Params: 90'00000000 1bd'c4fc72f0 1bd'c539f300 1bd'00000000

90'440fe140 1bd'ad3cf200 IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+78C0
    Params: '00000000 1bd'c4f8bf10 1bd'b484c9b0 1bd'c53d7230

90'440fe1f0 1bd'ad3cf816 IDEHelper64.dll BfCompiler_HotResolve_ReportTypeRange+7ED6
    Params: 1bd'00000000 1bd'bf950c18 1bd'c6fa2830 '00000028

90'440ff9c0 1bd'ad4444b7 IDEHelper64.dll CDep_Shutdown+12C37
    Params: 1bd'c4dad300 '00000001 '00000000 '00000000

90'440ff9f0 7ffa'637f7034 KERNEL32.DLL BaseThreadInitThunk+14
    Params: '00000000 '00000000 '00000000 '00000000

90'440ffa70 7ffa'645c2651 ntdll.dll RtlUserThreadStart+21
    Params: '00000000 '00000000 '00000000 '00000000


RAX:'00000000 RBX:'000000de RCX:'ffffffff RDX:'00000000 RSI:90'440fc028 RDI:1bd'ad1f1640
R8:90'440fbad8 R9:90'440fbb00 R10:'00000000 R11:90'440fbf30
R12:'00000000 R13:90'440fddb0 R14:1bd'ad1f1640 R15:90'440fc4e0
EIP:7ffa'49c84c13 ESP:90'440fbfb0 EBP:90'440fc070
CS:0033 SS:002B DS:002B ES:002B FS:0053 GS:002B
Flags:'00000206


CrashDump crash.zip

Arrorr avatar Mar 23 '21 16:03 Arrorr

while this doesnt reproduce on normal compiles (anymore?), something does crash here.

using System;
namespace CrashTest
{
	class Program
        {
		public static void Main()
                {
			var c = scope SomeClass();
			while (true)
				c.CrashFunction();
		}
	}

	public class SomeClass
        {
		public Result<StructWithMissingUsing> CrashFunction()
                {
			return StructWithMissingUsing();
		}
	}


	struct StructWithMissingUsing
        {
		//public SomeUnknownType type;
	}
}

Running this, the uncommenting the SomeUnknownType member and then hotswapping does crash.

EinScott avatar May 22 '21 09:05 EinScott