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
[SR-5137] Corrupt Return Value from Method Returning Tuple #47713
Comments
@swift-ci create |
I may have accidentally uploaded a non-working project before; apologies if you tried to run it. I've fixed the issues in the project in swift4bug.zip and you should now be able to run it without problems. |
I was just about to ask about that. The revised project builds with Xcode 8.3.2 but the output just shows "Opaque Value": Value within method: Vector3f(d: simd.float3(_vector: (Opaque Value))), Quaternion(x: Swift.Float(_value: (Opaque Value)), y: Swift.Float(_value: (Opaque Value)), z: Swift.Float(_value: (Opaque Value)), w: Swift.Float(_value: (Opaque Value))), Vector3f(d: simd.float3(_vector: (Opaque Value))) |
That's doubly odd. I downloaded the project again and I'm getting the same results – but Vector3.swift declares a conformance to CustomStringConvertible, and so my understanding is that that should be called when 'print'ing the value – maybe that's a second bug? Calling .description on the objects seems to work – I'll upload another project that does that soon. That output was also from running that original test case code, so perhaps Xcode was using an old module cache or something like that, and as such I was getting the correct output? I'm not entirely sure – just worth pointing out that I did get the output above by running the first project I submitted. |
See 'Swift 4 Bug - Amended.zip' for a version that I've just tested across two different computers after running a clean build and that displays the issue on Xcode 9 beta for me. If that also has issues then I'll be very perplexed. |
OK, I can reproduce it with that latest version. |
Fixed: #10501 |
Attachment: Download
Environment
Swift 4.0/Swift 3.2, Xcode 9 beta
Additional Detail from JIRA
md5: 1da37c68a65328553195e7c579800594
Issue Description:
In Swift 4/Swift 3.2 mode, return values of a function that returns a tuple are corrupted.
Within the method, variables have the correct value, but outside of it they have an incorrect value returned. I've attached an example project that exhibits this issue.
This code compiled correctly in Swift 3 (Xcode 8.3.2).
e.g.
outputs:
Value within method: Vector3f(x: -0.0, y: -0.0, z: 1.73205), Quaternion(x: -0.115917, y: 0.880476, z: -0.279848, w: 0.364705), Vector3f(x: 1.0, y: 1.0, z: 1.0)
Value returned: Vector3f(x: -0.0, y: -0.0, z: 1.73205), Quaternion(x: 0.0, y: 0.0, z: -0.279848, w: 0.364705), Vector3f(x: 1.0, y: 1.0, z: 0.0)
The text was updated successfully, but these errors were encountered: