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-15015] Using Glibc.errno/Darwin.errno generates concurrency warnings #57344

Open
Lukasa opened this issue Aug 3, 2021 · 1 comment
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Aug 3, 2021

Previous ID SR-15015
Radar rdar://problem/81450809
Original Reporter @Lukasa
Type Bug
Environment

Swift 5.5 nightly from the 30th of July.

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 57f4b34d377a090d52bc3e630f42d0dd

Issue Description:

Writing code that reads Glibc.errno or Darwin.errno generates concurrency warnings when compiled in -warn-concurrency mode:

/code/Sources/NIOCore/SystemCallHelpers.swift:66:23: warning: reference to var 'errno' is not concurrency-safe because it involves shared mutable state
            let err = errno
                      ^
Glibc.errno:1:12: note: var declared here
public var errno: Int32 { get set }
           ^

This warning is incorrect: errno is thread-local and so there is no concurrency failure here. Note that because it's thread-local it's not always safe to use errno in an actor context, but this warning is emitted even in non-actor contexts.

@ktoso
Copy link
Member

ktoso commented Aug 3, 2021

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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

2 participants