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-10260] SIL verification failure while compiling code using swift-5.0-RELEASE-ubuntu18.04 #52660

Closed
kasei opened this issue Apr 2, 2019 · 9 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 5.0

Comments

@kasei
Copy link
Contributor

kasei commented Apr 2, 2019

Previous ID SR-10260
Radar rdar://problem/49522825
Original Reporter @kasei
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Ubuntu 18.04
Swift version 5.0 (swift-5.0-RELEASE)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, 5.0Regression, CompilerCrash
Assignee @slavapestov
Priority Medium

md5: bb8e2042a30490ec536fae35e4c87aee

Issue Description:

A project I work on[1] is causing SIL verification failures when compiling using the new 5.0 toolchain on ubuntu 18.04 (it previously worked using the swift 4.2.4 toolchain as well as using the Xcode 5.0 toolchain on darwin):

SIL verification failed: method does not appear in the class's vtable: VerifyClassMethodVisitor( operandType.getASTType()->getMetatypeInstanceType() ->getClassOrBoundGenericClass(), member).Seen

I've attached the full error log which is emitted when running `swift build`.

[1] Project: https://github.com/kasei/kineo-endpoint (master at commit 9846313)

@belkadan
Copy link
Contributor

belkadan commented Apr 2, 2019

cc @slavapestov

@swift-ci
Copy link
Collaborator

swift-ci commented May 6, 2019

Comment by Ewan Mellor (JIRA)

I may have hit the same issue. (Please let me know if you disagree and I'll open a separate ticket.)

My code is at https://github.com/ewanmellor/antlr-swift-compiler-bug This is a copy of the ANTLR 4 Swift runtime, and its unit tests. To trigger the bug, run ./test.sh in the root of the repo. It will build the Antlr runtime library (which succeeds) and try to compile the tests, which fails.

The error message is the same as OP: "SIL verification failed: method does not appear in the class's vtable: VerifyClassMethodVisitor( operandType.getASTType()->getMetatypeInstanceType() ->getClassOrBoundGenericClass(), member).Seen". I've attached the full log.

This fails on Swift 5.0.0 and 5.0.1 on Ubuntu 16.04 Xenial and 18.04 Bionic. It compiles and runs just fine on Swift 5.0.1 from Xcode 10.2.1 on macOS 10.14.4 Mojave. (I'm surprised that there are any platform-specific differences at all at this level, but I'm seeing this both on my own machines and on Travis.)

We have had no such problems on Swift 4.2. Swift 5.0.0 was the first time this cropped up. The codebase is slightly different because of the migrations to Swift 5 obviously.)

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 6, 2019

Comment by Luiz Fernando Silva (JIRA)

@belkadan @slavapestov is there any news on this one? This is really a deal breaker for Linux builds. I'm using the exact same Antlr project that ewanmellor (JIRA User) mentioned, and even my heavily modified version also fails with this error.

@kasei
Copy link
Contributor Author

kasei commented Jul 8, 2019

I'd also like to know if there's any news on this. It's been over 3 months since I reported the crash, and aside from adding a label to the issue and assigning it, there seems to have been no movement on it whatsoever. It has completely stopped me from being able to do development work on this project on linux, and it would be helpful to know if it's being worked on, is high/low priority, if there's any way for me to help further (e.g. making an attempt at reducing the test case), or even if you can reproduce it. @belkadan @slavapestov, what do you say?

@slavapestov
Copy link
Member

I reproduced the bug and reduced a testcase.

The crash occurs when you use "super.foo()" to a call a method across a module boundary which the current class does not override. As a workaround, you can perform an ordinary call instead, "foo()". This will fix the crash.

However in this case since there's no override, the super.foo() call should behave identically to foo(), so I will prepare a fix.

@slavapestov
Copy link
Member

In @kasei's case, the method is ISO8601DateFormatter.date(from🙂. The reason this bug occurs on Linux and not on Mac is that on Linux, Foundation is written in Swift and the ISO8601DateFormatter class uses vtable dispatch. The bug is specific to the vtable dispatch implementation. On Mac, Foundation is written in Objective-C and the relevant code path in the compiler is not hit.

@slavapestov
Copy link
Member

#26000

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Aug 9, 2019

@kasei, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@kasei
Copy link
Contributor Author

kasei commented Aug 9, 2019

@AnnaZaks – Yes, this problem appears to be fixed in the latest swift 5.1 snapshot (July 24) for Ubuntu 18.04. Thanks!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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 A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression swift 5.0
Projects
None yet
Development

No branches or pull requests

5 participants