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

[mono] Full AOT error: Assertion at /__w/1/s/src/mono/mono/mini/method-to-ir.c:6456, condition `!sig->has_type_parameters' not met #91066

Closed
fanyang-mono opened this issue Aug 24, 2023 · 5 comments · Fixed by #91216
Assignees
Milestone

Comments

@fanyang-mono
Copy link
Member

fanyang-mono commented Aug 24, 2023

This full aot issue was found on CI lane linux-x64 Release AllSubsets_Mono_LLVMFullAot_RuntimeTests llvmfullaot

Link to the build failure: https://dev.azure.com/dnceng-public/public/_build/results?buildId=376086&view=logs&j=58dc7ccb-0414-5dd3-62a5-bf2e63258b7c&t=1a5c781f-8921-5969-0583-203a5fad54cb

  aot-compile: compiling /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests/UnsafeAccessorsTests.dll; MONO_PATH: /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests:/__w/1/s/artifacts/tests/coreclr/linux.x64.Release/Tests/Core_Root
  Unable to compile method 'UnsafeAccessorsTests/UserDataClass UnsafeAccessorsTests:CallPrivateConstructorClass ()' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataClass UnsafeAccessorsTests:CallPrivateConstructorClass (string)' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataValue UnsafeAccessorsTests:CallPrivateConstructorValue (string)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:_MVV (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:_mvv (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataClass UnsafeAccessorsTests:<Verify_CallCtorWithEmptyNotNullName>g__CallPrivateConstructorWithEmptyName|11_0 ()' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_CallCtorAsMethod>g__CallPrivateConstructor|12_0 (UnsafeAccessorsTests/UserDataClass,string)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_CallCtorAsMethodValue>g__CallPrivateConstructor|13_0 (UnsafeAccessorsTests/UserDataValue&,string)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_AccessStaticFieldClass>g__GetPrivateStaticField|14_0 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_AccessFieldClass>g__GetPrivateField|15_0 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_AccessStaticFieldValue>g__GetPrivateStaticField|16_0 (UnsafeAccessorsTests/UserDataValue)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_AccessFieldValue>g__GetPrivateField|17_0 (UnsafeAccessorsTests/UserDataValue&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_AccessStaticMethodClass>g__GetPrivateStaticMethod|18_0 (UnsafeAccessorsTests/UserDataClass,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_AccessMethodClass>g__GetPrivateMethod|19_0 (UnsafeAccessorsTests/UserDataClass,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_AccessStaticMethodVoidClass>g__GetPrivateStaticMethod|22_0 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_AccessMethodVoidClass>g__GetPrivateMethod|23_0 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_AccessStaticMethodValue>g__GetPrivateStaticMethod|24_0 (UnsafeAccessorsTests/UserDataValue,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_AccessMethodValue>g__GetPrivateMethod|25_0 (UnsafeAccessorsTests/UserDataValue&,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_IgnoreCustomModifier>g__CallPrivateGetter|26_0 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_IgnoreCustomModifier>g__CallPrivateSetter|26_1 (UnsafeAccessorsTests/UserDataClass,string)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_PreciseMatchCustomModifier>g__CallPrivateMethod|27_0 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_UnmanagedCallConvBitAreTreatedAsCustomModifiersAndIgnored>g__CallCdeclMethod|28_0 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_UnmanagedCallConvBitAreTreatedAsCustomModifiersAndIgnored>g__CallStdcallMethod|28_1 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_ManagedUnmanagedFunctionPointersDontMatch>g__CallCdeclMethod|29_2 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_ManagedUnmanagedFunctionPointersDontMatch>g__CallManagedMethod|29_3 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__OnBase|32_2 (UnsafeAccessorsTests/InheritanceDerived)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__BaseVirtual|32_3 (UnsafeAccessorsTests/InheritanceDerived)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__OnDerived|32_4 (UnsafeAccessorsTests/InheritanceDerived)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__Abstract|32_5 (UnsafeAccessorsTests/InheritanceBase)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__Virtual|32_6 (UnsafeAccessorsTests/InheritanceBase)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InheritanceMethodResolution>g__NewVirtual|32_7 (UnsafeAccessorsTests/InheritanceBase)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InheritanceFieldResolution>g__FieldOnBase|33_1 (UnsafeAccessorsTests/InheritanceDerived)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InheritanceFieldResolution>g__FieldOnDerived|33_2 (UnsafeAccessorsTests/InheritanceDerived)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__MethodNotFound|34_9 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__StaticMethodNotFound|34_10 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__FieldNotFound|34_11 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__FieldNotFoundStaticMismatch1|34_12 (UnsafeAccessorsTests/UserDataValue&)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__FieldNotFoundStaticMismatch2|34_13 (UnsafeAccessorsTests/UserDataValue)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__StaticFieldNotFound|34_14 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__CallPointerMethod|34_15 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'int UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessor>g__StaticMethodWithDifferentReturnType|34_16 (UnsafeAccessorsTests/UserDataClass,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidTargetUnsafeAccessorAmbiguousMatch>g__CallAmbiguousMethod|35_1 (UnsafeAccessorsTests/UserDataClass,*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__FieldReturnMustBeByRefClass|38_16 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__FieldReturnMustBeByRefValue|38_17 (UnsafeAccessorsTests/UserDataValue&)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__FieldArgumentMustBeByRef|38_18 (UnsafeAccessorsTests/UserDataValue)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__FieldMustHaveSingleArgument|38_19 (UnsafeAccessorsTests/UserDataClass,int)' due to: 'Method has zero rva'.
  Unable to compile method 'string& UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__StaticFieldMustHaveSingleArgument|38_20 (UnsafeAccessorsTests/UserDataClass,int)' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvalidKindValue|38_21 (UnsafeAccessorsTests/UserDataClass)' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataClass& UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvalidCtorSignatureClass|38_22 ()' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataValue& UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvalidCtorSignatureValue|38_23 ()' due to: 'Method has zero rva'.
  Unable to compile method 'UnsafeAccessorsTests/UserDataClass UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvalidCtorName|38_24 ()' due to: 'Method has zero rva'.
  Unable to compile method 'void UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvalidCtorType|38_25 ()' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__LookUpFailsOnPointers|38_26 (void*)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__LookUpFailsOnFunctionPointers|38_27 (*())' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests:<Verify_InvalidUseUnsafeAccessor>g__InvokeMethodOnValueWithoutRef|38_28 (UnsafeAccessorsTests/UserDataValue,string,string&,string&)' due to: 'Method has zero rva'.
  Unable to compile method 'string UnsafeAccessorsTests/Invalid:NonStatic (string)' due to: 'Method has zero rva'.
  Mono Ahead of Time compiler - compiling assembly /__w/1/s/artifacts/tests/coreclr/linux.x64.Release/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests/UnsafeAccessorsTests.dll
  AOTID FFA34055-EFE2-ACF9-EB07-BB63A1947EA8
  * Assertion at /__w/1/s/src/mono/mono/mini/method-to-ir.c:6456, 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.
  =================================================================
  
  =================================================================
  	External Debugger Dump:
  =================================================================
  
  =================================================================
  	Native stacktrace:
  =================================================================
  	0x7fa7a55a3561 - Unknown
  	0x7fa7a5545dfe - Unknown
  	0x7fa7a55a2e01 - Unknown
  	0x7fa7a6cf9cf0 - Unknown
  	0x7fa7a6041acf - Unknown
  	0x7fa7a6014ea5 - Unknown
  	0x7fa7a5662105 - Unknown
  	0x7fa7a5673d76 - Unknown
  	0x7fa7a566256f - Unknown
  	0x7fa7a56626d5 - Unknown
  	0x7fa7a5662717 - Unknown
  	0x7fa7a54d8947 - Unknown
  	0x7fa7a54a36e4 - Unknown
  	0x7fa7a5525983 - Unknown
  	0x7fa7a5516154 - Unknown
  	0x7fa7a5511a8e - Unknown
  	0x7fa7a550998b - Unknown
  	0x7fa7a55084c0 - Unknown
  	0x7fa7a5581557 - Unknown
  	0x559eb83336a1 - Unknown
  	0x7fa7a602dd85 - Unknown
  	0x559eb83307c9 - Unknown
@SamMonoRT
Copy link
Member

@fanyang-mono - The arm64 lane has been disabled for rc1 and all 8.0. Is this failure in x64 or arm64 ?
If arm64, please target a fix for 9.0.0 only.

@fanyang-mono
Copy link
Member Author

It is happening on x64 and maybe reproducible on arm64 as well. It is related to the new feature UnsafeAccessor. I would need to fix it for .NET8.

@fanyang-mono fanyang-mono changed the title [mono] AOT error: Assertion at /__w/1/s/src/mono/mono/mini/method-to-ir.c:6456, condition `!sig->has_type_parameters' not met [mono] Full AOT error: Assertion at /__w/1/s/src/mono/mono/mini/method-to-ir.c:6456, condition `!sig->has_type_parameters' not met Aug 25, 2023
@fanyang-mono
Copy link
Member Author

I was able to reproduce this locally by building runtime test baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.csproj and full AOT compile UnsafeAccessorsTests.dll. It is only reproducible with full AOT.

@fanyang-mono
Copy link
Member Author

fanyang-mono commented Aug 25, 2023

The assertion happened when Full AOT compile the UnsafeAccessor wrapper of the following method

    class Invalid
    {
        [UnsafeAccessor(UnsafeAccessorKind.Method, Name=nameof(ToString))]
        public extern string NonStatic(string a);

        [UnsafeAccessor(UnsafeAccessorKind.Method, Name=nameof(ToString))]
        public static extern string CallToString<U>(U a);     <--- This method
    }

(https://github.com/dotnet/runtime/blob/main/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.cs#L531)

This is the assertion it broke

if (!cfg->gshared)
    g_assert (!sig->has_type_parameters);

(https://github.com/dotnet/runtime/blob/main/src/mono/mono/mini/method-to-ir.c#L6455-L6456)

Clearly, the method Mono was trying to compile has a type parameter. However, it is not clear to me why gsharedvt was off. Need to look into why.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 28, 2023
@fanyang-mono
Copy link
Member Author

It is expected that gsharedvt was off, because it is a wrapper of an extern method.

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 29, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants