Skip to content

[mini] gshared static virtual methods: asserts !sig->has_type_parameters #65394

@lambdageek

Description

@lambdageek

Build and run this with gshared JIT:

namespace Gin {
    public interface I {
	static abstract void Foo<T>(T x);
    }

    public class C : I {
	public static void Foo<T>(T x) {
	    Console.WriteLine (x.GetType());
	}
    }

    public class G<U> where U : I {
	public void Caller<T> (T x) {
	    U.Foo(x);
	}
    }
}

namespace HelloWorld
{
    internal class Program
    {
        private static void Main(string[] args)
        {
	    var g = new Gin.G<Gin.C>();
	    g.Caller("123");
        }
    }
}

Expected result:

System.String

Actual result:

* Assertion at /Users/alklig/work/dotnet-runtime/runtime-bugs/src/mono/mono/mini/method-to-ir.c:6294, condition `!sig->has_type_parameters' not met


=================================================================
	Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x101f83e14 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_dump_native_crash_info
	0x101f2533e - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_handle_native_crash
	0x102027528 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : sigabrt_signal_handler.cold.1
	0x101f83748 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : sigabrt_signal_handler
	0x7ff808ed3e2d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x1 - Unknown
	0x7ff808e0ad10 - /usr/lib/system/libsystem_c.dylib : abort
	0x101fcf348 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : monoeg_assert_abort
	0x101e0918a - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_log_write_logfile
	0x101fcf8b2 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : monoeg_g_logv_nofree
	0x101fcfa2f - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : monoeg_assertion_message
	0x101fcfa6a - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_assertion_message
	0x101eb274a - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_method_to_ir
	0x101e75c8a - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mini_method_compile
	0x101e7869f - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_jit_compile_method_inner
	0x101e7d009 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : jit_compile_method_with_opt
	0x101e7c48a - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_jit_compile_method
	0x101f344e6 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : instantiate_info
	0x101f2f5c8 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : fill_runtime_generic_context
	0x101f287b6 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_rgctx_lazy_fetch_trampoline
	0x1017fc896 - Unknown
	0x101cf37eb - Unknown
	0x101e81032 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_jit_runtime_invoke
	0x101d9f468 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_runtime_invoke_checked
	0x101da74bc - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : do_exec_main_checked
	0x101edf7b2 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_jit_exec
	0x101ee2de6 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : mono_main
	0x101f5ef83 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libcoreclr.dylib : monovm_execute_assembly
	0x1018ee47d - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libhostpolicy.dylib : _Z19run_app_for_contextRK20hostpolicy_context_tiPPKc
	0x1018ef2e1 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libhostpolicy.dylib : corehost_main
	0x10187c0c5 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libhostfxr.dylib : _ZN10fx_muxer_t24handle_exec_host_commandERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERK19host_startup_info_tS8_RKNS0_13unordered_mapI13known_optionsNS0_6vectorIS6_NS4_IS6_EEEE18known_options_hashNS0_8equal_toISD_EENS4_INS0_4pairIKSD
	0x10187aead - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libhostfxr.dylib : _ZN10fx_muxer_t7executeENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiPPKcRK19host_startup_info_tPciPi
	0x1018778a8 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/libhostfxr.dylib : hostfxr_main_startupinfo
	0x1016b2795 - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/HelloWorld : _Z9exe_startiPPKc
	0x1016b29af - /Users/alklig/work/dotnet-runtime/runtime-bugs/artifacts/bin/HelloWorld/x64/Release/osx-x64/publish/HelloWorld : main
	0x102f8c4fe - Unknown

Note:

Does not crash with MONO_ENV_OPTIONS=--interp or MONO_ENV_OPTIONS=--optimize=-gshared

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions