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

[MPP, iOS, 1.3.50] EXC_BAD_ACCESS occurs when printing a negative Byte #3290

Closed
k-yamada opened this issue Aug 28, 2019 · 3 comments
Closed

[MPP, iOS, 1.3.50] EXC_BAD_ACCESS occurs when printing a negative Byte #3290

k-yamada opened this issue Aug 28, 2019 · 3 comments

Comments

@k-yamada
Copy link

@k-yamada k-yamada commented Aug 28, 2019

Kotlin version: 1.3.50
Device: iPhone 12.3.1 (Real device)

// Reproduce.kt:

class Reproduce {
    fun test() {
        val plusByte = 1.toByte()
        val zeroByte = 0.toByte()
        val minusByte = (-1).toByte()
        println(plusByte) // OK
        println(zeroByte) // OK
        println(minusByte) // ERROR: EXC_BAD_ACCESS
    }
}
// ViewController.swift:

import UIKit
import SharedCode

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        let reproduce = Reproduce()
        reproduce.test()
    }
}

EXC_BAD_ACCESS

Runnable example: k-yamada/mpp-ios-android#1

@SvyatoslavScherbina

This comment has been minimized.

Copy link
Contributor

@SvyatoslavScherbina SvyatoslavScherbina commented Aug 29, 2019

Thanks, confirmed.

@SvyatoslavScherbina

This comment has been minimized.

Copy link
Contributor

@SvyatoslavScherbina SvyatoslavScherbina commented Aug 29, 2019

The crash is caused by LLVM bug. It is fixed in LLVM 8, but unfortunately latest Xcode version doesn't seem to ship the fix.

To workaround the issue, please locate ~/.konan/kotlin-native-macos-1.3.50/konan/konan.properties file and replace the line

clangDebugFlags.ios_arm64 = -O0

with

clangDebugFlags.ios_arm64 = -O0 -mllvm -fast-isel=false
@k-yamada

This comment has been minimized.

Copy link
Author

@k-yamada k-yamada commented Aug 29, 2019

Thank you for telling me how to avoid this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.