Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Isr for division by zero not firing

Open KM198912 opened this issue 2 years ago • 1 comments

Area of Cosmos - What area of Cosmos are we dealing with?

Interrupts

Expected Behaviour - What do you think that should happen?

Exception by zero should throw a CPU panic

Actual Behaviour - What unexpectedly happens?

Cosmos totally ignores it and actually prints out 0 in writeline

Reproduction - How did you get this error to appear?

Try something like int a = 0/0; Console.WriteLine(a);

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)? Dev kit branch vs2022

KM198912 avatar May 17 '22 09:05 KM198912

The correct behavior should be that a DivideByZeroException (https://docs.microsoft.com/en-us/dotnet/api/system.dividebyzeroexception?view=net-6.0) is raised. This is currently happening. The issue seems to be with the following code https://github.com/CosmosOS/IL2CPU/blob/master/source/Cosmos.IL2CPU/IL/Div.cs#L178-L185

quajak avatar May 22 '22 14:05 quajak