The following program typechecks, but crashes.
#light "off"
#nowarn "62";;
open System
type hober<'a> = { foo : 'a }
type gromus<'a> = { foo : 'a }
type hoobler<'a>(arg : 'a) = class
member __.foo = arg
end
let inline
print_foo_memb<'a, 'b when
^a : (member foo : 'b)
>
x =
printfn "%A" (^a : (member foo : 'b) x)
[<EntryPoint>]
let main _ =
let a : hober<_> = { foo=1 } in
let b : gromus<_> = { foo="horp" } in
let c = hoobler("durr") in
// these are ok
print_foo_memb<_, int> a;
print_foo_memb<_, string> b;
print_foo_memb<_, string> c;
// these will cause a crash!
print_foo_memb a;
print_foo_memb b;
// but it seems to only happen when the (unannotated) function is applied to
// a record--classes are ok
print_foo_memb c;
0
On .NET:
Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'c:\users\msjp_000\documents\visual studio 2013\Projects\crashy\crashy\bin\Debug\crashy.exe'.
Additional information: The runtime has encountered a fatal error. The address of the error was at 0x72110237, on thread 0xd68. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
On Mono:
Unhandled Exception:
System.InvalidProgramException: Invalid IL code in Horp:main (string[]): IL_0082: callvirt 0x0a00000f
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in Horp:main (string[]): IL_0082: callvirt 0x0a00000f
This is with both fsc 3.1 and fsharpc 3.1.
The following program typechecks, but crashes.
On .NET:
On Mono:
This is with both fsc 3.1 and fsharpc 3.1.