Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #49904
lambdageek opened this issue Feb 15, 2022 · 3 comments · Fixed by #65459
Closed
Tracked by #49904

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

lambdageek opened this issue Feb 15, 2022 · 3 comments · Fixed by #65459
Assignees
Labels
area-Codegen-JIT-mono untriaged New issue has not been triaged by the area owner
Milestone

Comments

@lambdageek
Copy link
Member

lambdageek commented Feb 15, 2022

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

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 15, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@lambdageek
Copy link
Member Author

lambdageek commented Feb 15, 2022

Not sure if you need to pull Don't need #65390 to repro this

@lambdageek
Copy link
Member Author

lambdageek commented Feb 15, 2022

The IR for Caller<T_REF> looks kind of strange:

AFTER METHOD-TO-IR 3: [IN:  BB2(0), OUT:  BB1(0) ]
 il_seq_point intr il: 0x0
 move R19 <- R17
 move R20 <- R18
 move R22 <- R20
[RGCTX_FETCH [METHODCONST void Gin.I:Foo<T_REF> (T_REF)] -> METHOD_RGCTX] call R21 <-  [%rdi <- R22] clobbers: c
 move R23 <- R18
 load_membase R24 <- [R23 + 0x0]
 move R26 <- R24
[RGCTX_FETCH [VIRT_METHOD] -> VIRT_METHOD_CODE] call R25 <-  [%rdi <- R26] clobbers: c
 move R27 <- R21
 move R28 <- R19
 voidcall_reg R25 clobbers: c
 il_seq_point il: 0xc, nonempty-stack
 il_seq_point il: 0xc
 br [B1]

@vargaz vargaz self-assigned this Feb 15, 2022
vargaz added a commit to vargaz/runtime that referenced this issue Feb 16, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 16, 2022
vargaz added a commit that referenced this issue Feb 17, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 17, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Codegen-JIT-mono untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants