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-4569] Crash due to memory issue while using whole optimization #47146

Closed
swift-ci opened this issue Apr 12, 2017 · 3 comments
Closed

[SR-4569] Crash due to memory issue while using whole optimization #47146

swift-ci opened this issue Apr 12, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself optimized only Flag: An issue whose reproduction requires optimized compilation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-4569
Radar rdar://problem/31580779
Original Reporter alekite (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

macOS Sierra 10.12.4 (16E195)
Xcode 8.3.1 (8E1000a)
Apple Swift version 3.1 (swiftlang-802.0.51 clang-802.0.41)
Target: x86_64-apple-macosx10.9

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

md5: 5202cc4dbccde864c68b51815f79a77e

duplicates:

  • SR-4393 Miscompilation: object modified after being freed (Swift 3.1 regression)

Issue Description:

Problem:

Application crashed in randomly placed due to using flatMap with structs and using whole optimization:

        let directions = self.data.forecast?.flatMap { forecast -> Direction? in
            guard let date = forecast.date else {
                return nil
            }
            
            let rotation = forecast.direction?.radians ?? 0
            return Direction(date: date, rotationInRadians: rotation)
        }

Address Sanitizer shows double free problem on second iteration at this line:

            return WeatherChartWindDirection(date: date, rotationInRadians: rotation)
==75521==ERROR: AddressSanitizer: heap-use-after-free on address 0x60400006c260 at pc 0x00010a628740 bp 0x7fff555d74b0 sp 0x7fff555d74a8
WRITE of size 8 at 0x60400006c260 thread T0

Test project to repeat issue is attached

Workaround:

Turn off whole optimization.

@belkadan
Copy link
Contributor

@swift-ci create

@bob-wilson
Copy link

This sounds like https://bugs.swift.org/browse/SR-4393

@bob-wilson
Copy link

Yeah, this is fixed now.

@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 optimized only Flag: An issue whose reproduction requires optimized compilation
Projects
None yet
Development

No branches or pull requests

3 participants