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-13820] Crasher in StdlibUnittest.RangeSet #56218

Closed
swift-ci opened this issue Nov 3, 2020 · 4 comments
Closed

[SR-13820] Crasher in StdlibUnittest.RangeSet #56218

swift-ci opened this issue Nov 3, 2020 · 4 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

swift-ci commented Nov 3, 2020

Previous ID SR-13820
Radar None
Original Reporter michellecasbon (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 18.04

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @meg-gupta
Priority Medium

md5: c0e8d9509c991624bc8fd7d78a9dcc3d

blocks:

Issue Description:

Bisection reveals that #34188 causes a core dump in the StdlibUnittest.RangeSet test in S4TF, which looks to be a miscompile.

To reproduce in Ubuntu 18.04, use the tensorflow branch at 1e86c04.

1. Checkout compatible versions of auxiliary repos:

swift/utils/update-checkout --skip-repository swift --clone --scheme tensorflow

2. Run a build:

swift/utils/build-script --preset tensorflow_test

All tests pass at the commit that adds #30710.

3. Switch to one commit prior, delete the build/Ninja-ReleaseAssert/swift-linux-x86_64 directory, and build again.

git -C swift checkout f8a8d087bc498448b135c52df4d6a3c8485a9fca
rm -rf build/Ninja-ReleaseAssert/swift-linux-x86_64
swift/utils/build-script --preset tensorflow_test

The StdlibUnittest.RangeSet test now fails.

The test does not fail individually, only when run as part of a suite:

cd build/Ninja-ReleaseAssert/swift-linux-x86_64
ninja check-swift-validation-optimize-linux-x86_64

Debugging reveals that the problem exists in the every() function. If you replace the contents with this functional equivalent, the test passes:

func every(_ n: Int) -> [Element] {
  var a: Array<Element> = []
  sequence(first: startIndex) { i in
    self.index(i, offsetBy: n, limitedBy: self.endIndex)
  }.forEach { a.append(self[$0]) }
  return a
}
@compnerd
Copy link
Collaborator

compnerd commented Nov 3, 2020

+ @meg-gupta

@meg-gupta
Copy link
Contributor

This should be fixed with - https://github.com/apple/swift/pull/3463

@meg-gupta
Copy link
Contributor

Fixed with https://github.com/apple/swift/pull/3463

@swift-ci
Copy link
Collaborator Author

Comment by Michelle Casbon (JIRA)

Great, thank you for the speedy fix! `tensorflow` has been updated to match.

@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

3 participants