You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I tried to get a crash dump, but running lldb(swift repl) from within an lldb kept stopping at the 'exec', presumably due to launching an inferior inferior process. In any case, it's fairly trivial to reproduce if you know the magic incantations necessary from lldb.
Additional Detail from JIRA
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.
The text was updated successfully, but these errors were encountered: