-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[s390x] Undefined behaviour in float32 #107387
Comments
Tagging subscribers to this area: @lambdageek, @steveisok |
Hi @saitama951, this looks suspiciously like a codegen bug. Can you extract the IL and generated assembly for your small test case in both the good and the bad case? Also, maybe you can identify a specific runtime commit (via bisect) that introduced this behavior? |
Hi @uweigand, here is a more clean reproducible of the behavior.
Now we have the uncommented case (here the output is -1 ) and the commented case (here the output is 1) case 1: Commented
here only the sign bit is shifted away for some reason resulting the cc to 3, I don't exactly understand why? (probably anything that is overflowed into the sign bit is undefined?) case 2: Uncommented
now the r2 values differ which are sent from the case 1: Commented
case 2: Uncommented
here what I don't understand is why do we do a 32 bit store when we do a 64 bit load into r2 in
I think replacing the |
Hi @saitama951, there's two issues I can see here. First of all, I agree that use of While this would already fix the current issue, there's still another concern. According to the s390x ELF ABI, signed 32-bit integers must always passed as sign-extended 64-bit values. This means that |
@uweigand Thank you for clearing my doubts, I will continue to debug this. |
Fixes dotnet#107387 The slag instructions throws an undefined behavior when moving from Float to Int in OP_MOVE_I4_TO_F
Fixes dotnet#107387 The slag instructions throws an undefined behavior when moving from Float to Int in OP_MOVE_I4_TO_F
Recently we started seeing test case failures relating to
System.Buffers.Binary.Tests.BinaryWriterUnitTests.SpanWriteSingle
Test case:
the corresponding tests fails with
I had extracted out the test case for my simplicity with various console printing
the following program gives me the expected output
when Uncommenting the a simple Console.WriteLine from the if condition the output changes.
output:
cc: @giritrivedi @omajid @uweigand @iii-i
The text was updated successfully, but these errors were encountered: