Skip to content

[SR-2879] Creating 4 calendars results in an assertion failure #3924

Closed
@alblue

Description

@alblue
Previous ID SR-2879
Radar None
Original Reporter @alblue
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @alblue
Priority Medium

md5: 6c8273abf9d22068045fc840a683dc37

relates to:

  • SR-2462 Compiler is sometimes overreleasing CF objects

Issue Description:

This code fails on Linux when assertions are enabled in a build:

```
$ swift-dev/usr/bin/swift
Welcome to Swift version 3.0-dev (LLVM b9bd56d1b8, Clang de97de0726, Swift 44b8a0bd12). Type :help for assistance.
1> import Foundation
2. _ = Calendar(identifier:.buddhist)
3. _ = Calendar(identifier:.chinese)
4. _ = Calendar(identifier:.islamic)
5. _ = Calendar(identifier:.gregorian)
repl_swift: /home/ablewitt/swift-build/swift/include/swift/Runtime/../../../stdlib/public/SwiftShims/RefCount.h:252: bool StrongRefCount::doDecrementShouldDeallocate() [ClearPinnedFlag = false]: Assertion `newval + quantum >= RC_ONE && "releasing reference with a refcount of zero"' failed.
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
6> :bt

If assertions are disabled, then the code appears to work (but we may have a use-after-free). Running the same code after the failure occurs results in success. It doesn't appear to matter which calendar identifiers are used (provided that they are different to each other)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions