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

[SR-15266] Concurrency segfault withTaskGroup and SIMD #57588

Closed
swift-ci opened this issue Sep 30, 2021 · 5 comments
Closed

[SR-15266] Concurrency segfault withTaskGroup and SIMD #57588

swift-ci opened this issue Sep 30, 2021 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15266
Radar None
Original Reporter timdecode (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment
swiftc --version
swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)
Target: x86_64-apple-macosx12.0
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug
Assignee @rjmccall
Priority Medium

md5: 56125578b3d43aefa3d6c01cf17fe4f4

Issue Description:

Returning SIMD types from withTaskGroup segfaults on x86_64 and the release version of Swift 5.5 on macOS and Linux.

The following code segfaults on x86_64 with the release version of Swift 5.5:

// Compile with: swiftc -parse-as-library <filename.swift>
@main
enum Main
{
    static
    func main() async
    {
        await withTaskGroup(of: SIMD4<Int32>.self) 
        { 
            (group:inout TaskGroup) in
            group.addTask 
            {
                return SIMD4<Int32>.init(repeating: 0)
            }
        }
    }
}

SIMD2<Int32> does not segfault. This smells like an alignment issue to me.

This crashes on x86_64 for:

  • Xcode 13 Beta 5 (13A5212g)

  • Xcode 13 Release (13A233)

  • Xcode 13.1 Release (13A1030d)

  • Swift-5.5-RELEASE on Linux

I don't get the crash on Apple Silicon (A10). I do get the crash in the simulator (x86_64).

Thanks to @Kelvin13 for simplifying the example and for testing this on Linux.

This is also filed in Apple's Feedback Assistant as: FB9531735

@tayloraswift
Copy link
Contributor

update: just tested with a locally-compiled swift toolchain. three other stack corruption bugs appear to have been fixed, but this issue is still present.

@swift-ci
Copy link
Collaborator Author

Comment by Timothy Davison (JIRA)

Thanks @Kelvin13.

I just checked this with the Xcode 13.1 release candidate (13A1030d) and it still segfaults on x86_64.

swiftc --version Swift``swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)``Target: x86_64-apple-macosx12.0

@swift-ci
Copy link
Collaborator Author

Comment by Timothy Davison (JIRA)

This is still present in the Xcode 13.1 release.

swiftc --version``swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)``Target: x86_64-apple-macosx12.0

@DougGregor
Copy link
Member

#39829

@rjmccall
Copy link
Member

This is fixed in #39829 That bug requires changes to the runtime, so it's unclear whether we're going to be able to fix it in shipping Apple operating systems, but it should be fixed going forward on non-Apple systems and (eventually) in future Apple OSes.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

4 participants