Skip to content

[SR-3132] Invalid pointer dequeued from free list. Runtime crash on some weird code. #45720

@swift-ci

Description

@swift-ci
Previous ID SR-3132
Radar rdar://problem/34992686
Original Reporter plivesey (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, RunTimeCrash
Assignee @slavapestov
Priority Medium

md5: e5a714538eff95d9400fe430806b9c2a

Issue Description:

Run the following code (sometimes works in a playground):

class X {
    public init?(error: (String) throws ->Void) rethrows {
        try error("dictionary is not valid!")
        return nil
    }

    public convenience init() throws {
        try self.init() { _ in
            throw NSError(domain: "", code: 0, userInfo: nil)
            }!
    }
}     
   
do {
    let x = try X()
} catch {
    print("hi")
}

Expected: Either this should not compile, or it should EXC_BAD_ACCESS because of the ! (even though I feel like it should throw out of there? maybe not...as I said, the code is weird).

Actual:

malloc: *** error for object 0x6080000174ac: Invalid pointer dequeued from free list
-   -   -   set a breakpoint in malloc_error_break to debug

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during execution

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions