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

[ARM][ARM64] Problems with empty struct passing #104369

Open
tomeksowi opened this issue Jul 3, 2024 · 1 comment
Open

[ARM][ARM64] Problems with empty struct passing #104369

tomeksowi opened this issue Jul 3, 2024 · 1 comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@tomeksowi
Copy link
Contributor

tomeksowi commented Jul 3, 2024

Issue for CI failures on 32- and 64-bit ARM for the new tests introduced in #104237

I identified the issue with empty struct argument on arm32 as a bug in Clang similar to RISC-V, raised [here](https://github.com/llvm/llvm-project/issues/97285#issuecomment-2205742277].

But there are some CI failures which I cannot reproduce running in docker images:

  • mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-net9.0
  • mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm64-net9.0

OSX ARM 64-bit (Checked)

This one has symptoms similar to the Clang bug mentioned above -- the empty struct argument was not assigned a register. I checked the asm from Clang on ARM64 (albeit linux) and it looks fine. However, the stack trace doesn't point which of the calls, native or managed, failed so the problem could also be on the .NET side.

BEGIN EXECUTION
/tmp/helix/working/B45209B9/p/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true EmptyStructs.dll ''
Xunit.Sdk.EqualException: Assert.Equal() Failure: Values differ
Expected: 0
Actual:   3
at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer) in /_/src/Microsoft.DotNet.XUnitAssert/src/EqualityAsserts.cs:line 168
at Program.Test_Empty_Sanity()
at __GeneratedMainWrapper.Main()
Expected: 100
Actual: 101
END EXECUTION - FAILED

Linux ARM 32-bit and 64-bit (Checked)

A crash in PackedEmptyFloatLong.Equals()

waitpid() returned successfully (wstatus 00000000) WEXITSTATUS 0 WTERMSIG 0
/root/helix/work/workitem/e/JIT/Directed/Directed_3/../StructABI/EmptyStructs/EmptyStructs.sh: line 441:   171 Bus error               (core dumped) $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"

Return code:      1
Raw output file:      /root/helix/work/workitem/uploads/StructABI/EmptyStructs/output.txt
Raw output:
BEGIN EXECUTION
/root/helix/work/correlation/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true EmptyStructs.dll ''
[createdump] Gathering state for process 171 corerun
[createdump] Crashing thread 00ab signal 7 (0007)
[createdump] Writing crash report to file /home/helixbot/dotnetbuild/dumps/coredump.171.dmp.crashreport.json
[createdump] Crash report successfully written
[createdump] Writing minidump with heap to file /home/helixbot/dotnetbuild/dumps/coredump.171.dmp
[createdump] Written 55050240 bytes (13440 pages) to core file
[createdump] Target process is alive
[createdump] Dump successfully written in 75ms
Expected: 100
Actual: 135
END EXECUTION - FAILED
Test failed. Trying to see if dump file was created in /home/helixbot/dotnetbuild/dumps since 7/3/2024 1:07:38 PM
Processing /home/helixbot/dotnetbuild/dumps/coredump.171.dmp.crashreport.json
Printing stacktrace from '/home/helixbot/dotnetbuild/dumps/coredump.171.dmp.crashreport.json'
Invoking llvm-symbolizer --pretty-print
Stack trace:

Thread Id: 0xab
Child SP               IP Call Site
0xffd6c310 0xf7787614 libc.so.6!
0xffd6c318 0xf77f19c0 libc.so.6!__wait4_time64
0xffd6c380 0xf768583c libcoreclr.so!PROCCreateCrashDump(std::vector<char const*, std::allocator<char const*> >&, char*, int, bool) at /__w/1/s/src/coreclr/pal/src/thread/process.cpp:2308:22
0xffd6c3c8 0xf768663c libcoreclr.so!PROCCreateCrashDumpIfEnabled at /__w/1/s/src/coreclr/pal/src/thread/process.cpp:2526:9
0xffd6c418 0xf763b0de libcoreclr.so!invoke_previous_action(sigaction*, int, siginfo_t*, void*, bool) at /__w/1/s/src/coreclr/pal/src/exception/signal.cpp:422:13
0xffd6c450 0xf763a3e4 libcoreclr.so!sigbus_handler(int, siginfo_t*, void*) at /__w/1/s/src/coreclr/pal/src/exception/signal.cpp:722:1
0xffd6c470 0xf77971b0 libc.so.6!
0xffd6c7e0 0xf7289b74 libcoreclr.so!long long VolatileLoad<long long>(long long const*) at /__w/1/s/src/coreclr/inc/volatile.h:188:13
(inlined by) FieldDesc::GetInstanceField(OBJECTREF, void*) at /__w/1/s/src/coreclr/vm/field.cpp:315:28
0xffd6c830 0xf73bb0da libcoreclr.so!InvokeUtil::GetFieldValue(FieldDesc*, TypeHandle, OBJECTREF*, TypeHandle, bool*) at /__w/1/s/src/coreclr/vm/invokeutil.cpp:0:21
0xffd6c8c8 0xf74131d2 libcoreclr.so!RuntimeFieldHandle::GetValue(ReflectFieldObject*, Object*, ReflectClassBaseObject*, ReflectClassBaseObject*, bool*) at /__w/1/s/src/coreclr/vm/reflectioninvocation.cpp:58:8
0xffd6c9e8 0xeed24ee2 System.Reflection.FieldAccessor.GetValue(System.Object)
0xffd6ca10 0xeeb20296 System.ValueType.Equals(System.Object)
0xffd6ca60 0xedd5644e Xunit.Sdk.AssertEqualityComparer1[[Program+PackedEmptyFloatLong, EmptyStructs]].Equals(PackedEmptyFloatLong, Xunit.Sdk.CollectionTracker, PackedEmptyFloatLong, Xunit.Sdk.CollectionTracker, System.Nullable1<Int32> ByRef)
0xffd6caa8 0xedd56214 Xunit.Sdk.AssertEqualityComparer1[[Program+PackedEmptyFloatLong, EmptyStructs]].Equals(PackedEmptyFloatLong, PackedEmptyFloatLong)  0xffd6cb00 0xedd55ac8 Xunit.Assert.Equal[[Program+PackedEmptyFloatLong, EmptyStructs]](PackedEmptyFloatLong, PackedEmptyFloatLong, System.Collections.Generic.IEqualityComparer1<PackedEmptyFloatLong>)
0xffd6cba0 0xedd557ca 0xedd557ca
0xffd6cc40 0xf5ea11bc __GeneratedMainWrapper.Main()

Thread Id: 0xac
Child SP               IP Call Site
0xf708ebd0 0xf7787614 libc.so.6!
0xf708ebd8 0xf7812f44 libc.so.6!poll
0xf708ebe8 0xf767b940 libcoreclr.so!CorUnix::CPalSynchronizat

Part of dump on 64-bit:

    {
      "is_managed": "true",
      "module_address": "0xffff7815c000",
      "stack_pointer": "0xfffffbf1ee30",
      "native_address": "0xffff7a8f7750",
      "native_offset": "0xb8",
      "native_image_offset": "0x279b750",
      "token": "0x6000187",
      "il_offset": "0x18",
      "method_name": "Xunit.Sdk.AssertEqualityComparer`1[[Program+PackedEmptyFloatLong, EmptyStructs]].Equals(PackedEmptyFloatLong, PackedEmptyFloatLong)",
      "timestamp": "0xf7bc5bea",
      "sizeofimage": "0x30000",
      "filename": "xunit.assert.dll",
      "guid": "78e794f267894b9d819e00349ad59a9c"
     },
     {
      "is_managed": "true",
      "module_address": "0xffff7815c000",
      "stack_pointer": "0xfffffbf1ee90",
      "native_address": "0xffff7a8f6d8c",
      "native_offset": "0x1dc",
      "native_image_offset": "0x279ad8c",
      "token": "0x600006e",
      "il_offset": "0x5e",
      "method_name": "Xunit.Assert.Equal[[Program+PackedEmptyFloatLong, EmptyStructs]](PackedEmptyFloatLong, PackedEmptyFloatLong, System.Collections.Generic.IEqualityComparer`1<PackedEmptyFloatLong>)",
      "timestamp": "0xf7bc5bea",
      "sizeofimage": "0x30000",
      "filename": "xunit.assert.dll",
      "guid": "78e794f267894b9d819e00349ad59a9c"
     },
     {
      "is_managed": "true",
      "module_address": "0xffff781a7000",
      "stack_pointer": "0xfffffbf1ef80",
      "native_address": "0xffff7a8f6a14",
      "native_offset": "0x1dc",
      "native_image_offset": "0x274fa14",
      "token": "0x600004f",
      "il_offset": "0x33",
      "method_name": "Program.Test_PackedEmptyFloatLong_RiscV()",
      "timestamp": "0xb73ebc7b",
      "sizeofimage": "0xc000",
      "filename": "EmptyStructs.dll",
      "guid": "6be11288d684450fa29eb51e60556e67"
     },

Part of #84834

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 3, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jul 3, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@JulieLeeMSFT JulieLeeMSFT added this to the 10.0.0 milestone Jul 8, 2024
@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

2 participants