-
Couldn't load subscription status.
- Fork 351
Description
| Previous ID | SR-7487 |
| Radar | None |
| Original Reporter | @alblue |
| Type | Bug |
| Status | Reopened |
| Resolution |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | LLDB for Swift |
| Labels | Bug, REPL |
| Assignee | None |
| Priority | Medium |
md5: ac1256c94df62a3aa7b0b4925b8f1b40
Issue Description:
When running Swift 4.1 on Linux, running the interpreter with the following results in a crash:
$ export C_INCLUDE_PATH=/usr/lib/swift/clang/include
$ export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
$ swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
1> import Foundation
2> NSRegularExpression(pattern:"(.*)",options:[])
$R0: Foundation.NSRegularExpression = {
Foundation.NSObject = {}
Segmentation fault
Modifying to store the return value does not have this effect:
$ swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
1> import Foundation
2> _ = NSRegularExpression(pattern:"(.*)",options:[])
3> ^D
If the value is stored to an intermediate value, then printed, the error is seen:
swift
Welcome to Swift version 4.1 (swift-4.1-RELEASE). Type :help for assistance.
1> import Foundation
2> let a = NSRegularExpression(pattern:"(.*)",options:[])
a: Foundation.NSRegularExpression = {
Foundation.NSObject = {}
Segmentation fault
However, if the value is printed (with print or debugPrint) then we don't see the issue:
3> debugPrint(NSRegularExpression(pattern:"(.*)",options:[]))
<NSRegularExpression: 0x0000555555599ca0>
4> print(NSRegularExpression(pattern:"(.*)",options:[]))
<NSRegularExpression: 0x0000555555599ca0>
5>
So there is something in the way that the interpreter is trying to unpack or display the result that's causing the segfault.
Created on an Ubuntu runtime with Swift 4.1 release.