-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
| Previous ID | SR-3449 |
| Radar | None |
| Original Reporter | @marcelofabri |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Swift version 3.0.2 (swift-3.0.2-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Foundation |
| Labels | Bug, Linux, RunTimeCrash |
| Assignee | None |
| Priority | Medium |
md5: 9d230cee40d115dbcd2c6d41a829ae43
relates to:
- SR-3448 Crash in String.replacingOccurrences(of:with:) with emoji on Linux
Issue Description:
When using String.replacingCharacters(in:with:) with emoji on Linux, I get a crash. This does not happen on macOS with the Xcode 8.2 Swift build.
This is likely related to https://bugs.swift.org/browse/SR-3448.
Sample code:
import Foundation
let str = "\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466} marcelo "
if let range = str.range(of: "ce") {
let updated = str.replacingCharacters(in: range, with: "")
print(updated)
}Stacktrace:
swift SwiftLint/file3.swift
0 swift 0x00000000035c37a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000000035c3f07
2 libpthread.so.0 0x00007f8a9e5f03e0
3 libFoundation.so 0x00007f8a98eab2d9 _TTSf4s_gs_n___TFC10Foundation15NSMutableString17replaceCharactersfT2inVS_8_NSRange4withSS_T_ + 1161
4 libFoundation.so 0x00007f8a98e9e12e _TFC10Foundation8NSString19replacingCharactersfT2inVS_8_NSRange4withSS_SS + 270
5 libFoundation.so 0x00007f8a98eb08c7 _TFE10FoundationSS19replacingCharactersfT2inGVs5RangeVVSS13CharacterView5Index_4withSS_SS + 103
6 libFoundation.so 0x00007f8a9e958240 _TFE10FoundationSS19replacingCharactersfT2inGVs5RangeVVSS13CharacterView5Index_4withSS_SS + 95058400
7 swift 0x0000000000c59d58 llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 808
8 swift 0x0000000000c5d782 llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, char const* const*) + 1282
9 swift 0x00000000007f208b swift::RunImmediately(swift::CompilerInstance&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 2555
10 swift 0x00000000007ea727
11 swift 0x00000000007e59a1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2737
12 swift 0x00000000007ab0c3 main + 2787
13 libc.so.6 0x00007f8a9cf23830 __libc_start_main + 240
14 swift 0x00000000007a8769 _start + 41
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -interpret SwiftLint/file3.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name file3
Illegal instruction