Skip to content

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

@swift-ci

Description

@swift-ci
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
}

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions