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-8285] REPL doesn't like nil with optional unowned/unowned(unsafe) #4365

Closed
davezarzycki opened this issue Jul 17, 2018 · 10 comments
Closed
Assignees
Labels
bug Something isn't working LLDB for Swift

Comments

@davezarzycki
Copy link
Collaborator

Previous ID SR-8285
Radar rdar://problem/42301922
Original Reporter @davezarzycki
Type Bug
Status Closed
Resolution Invalid
Environment

Red Hat Fedora 28 with top-of-tree clang+llvm+lld as the local compiler.

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee @davezarzycki
Priority Medium

md5: a18d2d7cf822aa1dc372fa4ad4f2ac14

Issue Description:

Top-of-tree Swift now enables optional types to be used with unowned/unowned(unsafe), but this confuses LLDB:

$ ./bin/swift
Welcome to Swift version 4.2-dev. Type :help for assistance.
1> class C { unowned var next : C? }
error: Couldn't lookup symbols:
swift_allocObject
swift_beginAccess
swift_endAccess
swift_registerTypeMetadataRecords
swift_registerFieldDescriptors
value witness table for Builtin.NativeObject
type metadata accessor for Swift.Optional
swift_deallocClassInstance
swift_unownedRetainStrong
swift_unownedRelease
swift_release
swift_unownedRetain

1> let c = C()
Process 31578 stopped

  • thread [DON'T MERGE] Test pull request #1, name = 'repl_swift', stop reason = signal SIGSEGV: invalid address (fault address: 0xbad0bad0)
    frame #0: 0x00000000bad0bad0
    error: memory read failed for 0xbad0ba00
    Target 0: (repl_swift) stopped.
    c: C = <extracting data from value failed>

Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
2>

@dcci
Copy link
Mannequin

dcci mannequin commented Jul 17, 2018

Yes, this is clearly a bug. @davezarzycki are you going to work on this or you want us to take a look?
@swift-ci create

@swift-ci
Copy link

Comment by Jim Ingham (JIRA)

I think this is a general problem with the TOT swift REPL on Linux. OTOH, I have another report of a similar (but not identical) failure in the current TOT linux REPL, OTOH this construct works fine on both the lldb:stable/swift:master branches of lldb and the lldb:upstream-with-swift/swift:master-next branches of lldb.

@davezarzycki
Copy link
Collaborator Author

For clarity: it seems like there are two bugs here. First, the "Couldn't lookup symbols" noise. And second, the SIGSEGV bug while creating an object with an optional unowned. I'd prefer that this bug be about the latter. Thanks!

As to task assignment, the REPL isn't on my critical path and therefore I don't foresee working on this in the short to medium term. Sorry. :-(

@swift-ci
Copy link

Comment by Jim Ingham (JIRA)

But again, neither of these bugs occur on the current TOT swift REPL on macOS. Both expressions run without error and give the expected results. My guess is this is more general (though recently introduced) badness in the Linux Swift REPL.

@davezarzycki
Copy link
Collaborator Author

Interesting. I rarely test the Linux REPL, but anecdotally speaking, I think it has been broken for a long time. Then again, I never install the built product, and I build/test Swift with the ToT llvm+clang compiler, so maybe I've wandered deep in the weeds. I don't know if this information helps.

@swift-ci
Copy link

Comment by Jim Ingham (JIRA)

There are tests that test basic REPL behavior in the testsuite. We should make sure they are still running on Linux.

@dcci
Copy link
Mannequin

dcci mannequin commented Jul 18, 2018

I'm afraid I really can't reproduce this on my Linux machine, David.

davide@rad:~/work/build/Ninja-ReleaseAssert/lldb-linux-x86_64/bin$ ./lldb --repl
Welcome to Swift version 4.2-dev (LLVM 748f9878c8, Clang 6c624d9bad, Swift 86c26a9e32). Type :help for assistance.
  1> class C { unowned var next : C? }
  2>  let c = C()
c: C = {
  next = nil
}

@dcci
Copy link
Mannequin

dcci mannequin commented Jul 18, 2018

FWIW, this is my configuration:

uname:

 uname -a
Linux 4.4.0-45-generic #&#8203;66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

To the best of my understanding, you're building with Red hat, which isn't quite a supported (officially) system. Might I ask you to try with Ubuntu?

@davezarzycki
Copy link
Collaborator Author

I don't have access to an Ubuntu machine. At this point, I'd wager that the issue is not the OS but that I prefer unified builds over the slow "build-script". Let's just close this. Does that work for you?

@davezarzycki
Copy link
Collaborator Author

Confirmed. The LLDB test suite fails spectacularly with unified builds, but when I try a `build-script` build, only two LLDB tests fail (pull request pending). Let's close this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 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 Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants