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-12253] Compiler segfault 11 on Xcode 11.4 (beta 2) #54680

Closed
swift-ci opened this issue Feb 21, 2020 · 4 comments
Closed

[SR-12253] Compiler segfault 11 on Xcode 11.4 (beta 2) #54680

swift-ci opened this issue Feb 21, 2020 · 4 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 SILGen Area → compiler: The SIL generation stage

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12253
Radar rdar://59669591
Original Reporter rog (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment
  • Apple Swift version 5.2 (swiftlang-1103.0.25.1 clang-1103.2.32.5)

  • macOS Catalina 10.15.3

  • Xcode 11.4 (beta 2)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, SILGen
Assignee @slavapestov
Priority Medium

md5: 09582bc40947696055f0db89c7bd9c5f

Issue Description:

*The compiler will Segfault in the following condition: *

1) Given a subclass of a base class
2) The subclass has a generic argument
3) The base class exposes an optional property
4) The subclass overrides the optional property with a non-optional property

Steps to repro

Paste the following code in a swift file, try to build:

class BaseViewController: UIViewController {
    var myInteger: Int? {
        return nil
    }
}

class ViewController<Item>: BaseViewController {
    override var myInteger: Int {
        return 1
    }
}

Stacktrace

Stack trace:

1. Apple Swift version 5.2 (swiftlang-1103.0.25.1 clang-1103.2.32.5)
2. While generating vtable thunk SIL function "@$s12SegFaultTest14ViewControllerC9myIntegerSivgAA04BasedE0CADSiSgvgTV".
for getter for myInteger (at /Users/rogerio.assis/Desktop/z/SegFaultTest/SegFaultTest/ViewController.swift:18:18)
0 swift 0x0000000108fc4033 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x0000000108fc37f0 SignalHandler(int) + 352
2 libsystem_platform.dylib 0x00007fff6e3c642d _sigtramp + 29
3 libsystem_platform.dylib 0x0000000000000008 _sigtramp + 2445515768
4 swift 0x00000001059ddbce swift::Type llvm::function_ref<swift::Type (swift::Type)>::callback_fn<swift::GenericFunctionType::substGenericArgs(swift::SubstitutionMap)::$_16>(long, swift::Type) + 78
5 swift 0x00000001059ddcba swift::GenericFunctionType::substGenericArgs(llvm::function_ref<swift::Type (swift::Type)>) const + 186
6 swift 0x0000000104d96bcf swift::Lowering::SILGenFunction::emitVTableThunk(swift::SILDeclRef, swift::SILDeclRef, swift::SILFunction*, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::CanTypeWrapper<swift::AnyFunctionType>, bool) + 1135
7 swift 0x0000000104db0903 (anonymous namespace)::SILGenType::emitType() + 5523
8 swift 0x0000000104cbff22 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 82
9 swift 0x0000000104cbf0ec swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1356
10 swift 0x0000000104cc116e swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 1438
11 swift 0x0000000104890855 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 60677
12 swift 0x0000000104801b83 main + 1299
13 libdyld.dylib 0x00007fff6e1cd7fd start + 1
14 libdyld.dylib 0x000000000000004b start + 2447583311
error: Segmentation fault: 11 (in target 'SegFaultTest' from project 'SegFaultTest')

@theblixguy
Copy link
Collaborator

On master:

Assertion failed: (signature || !origType->hasTypeParameter()), function initSwiftType, file /Users/suyashsrijan/Documents/swift-src/swift/include/swift/SIL/AbstractionPattern.h, line 322.
Stack dump:
0.  Program arguments: ./swiftc -frontend -typecheck -emit-sil /Users/suyashsrijan/Desktop/test.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
1.  Swift version 5.2-dev (LLVM 66300b73b1, Swift 3fdbd1cc9e)
2.  While evaluating request SILGenWholeModuleRequest(SIL Generation for module test)
0  swiftc                   0x00000001053805b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swiftc                   0x000000010537f7f5 llvm::sys::RunSignalHandlers() + 85
2  swiftc                   0x0000000105380b9c SignalHandler(int) + 268
3  libsystem_platform.dylib 0x00007fff70da242d _sigtramp + 29
4  swiftc                   0x0000000107c0bcd0 cmark_strbuf__initbuf + 170800
5  libsystem_c.dylib        0x00007fff70c77a1c abort + 120
6  libsystem_c.dylib        0x00007fff70c76cd6 err + 0
7  swiftc                   0x00000001056a0c13 swift::Lowering::TypeConverter::getLoweredFormalTypes(swift::SILDeclRef, swift::CanTypeWrapper<swift::AnyFunctionType>) (.cold.14) + 35
8  swiftc                   0x0000000101c23ca0 swift::Lowering::TypeConverter::getLoweredFormalTypes(swift::SILDeclRef, swift::CanTypeWrapper<swift::AnyFunctionType>) + 160
9  swiftc                   0x0000000101c263d6 swift::Lowering::TypeConverter::getConstantOverrideInfo(swift::TypeExpansionContext, swift::SILDeclRef, swift::SILDeclRef) + 1078
10 swiftc                   0x00000001017755d0 swift::Lowering::SILGenModule::emitVTableMethod(swift::ClassDecl*, swift::SILDeclRef, swift::SILDeclRef) + 1056
11 swiftc                   0x0000000101777756 (anonymous namespace)::SILGenType::emitType() + 518
12 swiftc                   0x0000000101777549 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
13 swiftc                   0x000000010169e753 (anonymous namespace)::SILGenModuleRAII::emitSourceFile(swift::SourceFile*) + 883
14 swiftc                   0x000000010169f704 swift::SILGenWholeModuleRequest::evaluate(swift::Evaluator&, swift::SILGenDescriptor) const + 180
15 swiftc                   0x000000010176b371 swift::SimpleRequest<swift::SILGenWholeModuleRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::SILGenDescriptor), (swift::CacheKind)0>::evaluateRequest(swift::SILGenWholeModuleRequest const&, swift::Evaluator&) + 33
16 swiftc                   0x00000001016a2b17 llvm::Expected<swift::SILGenWholeModuleRequest::OutputType> swift::Evaluator::getResultUncached<swift::SILGenWholeModuleRequest>(swift::SILGenWholeModuleRequest const&) + 343
17 swiftc                   0x000000010169f884 swift::performSILGeneration(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&) + 116
18 swiftc                   0x00000001013cfbc9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation const&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8681
19 swiftc                   0x00000001013cca18 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4472
20 swiftc                   0x000000010136421d main + 861
21 libdyld.dylib            0x00007fff70ba97fd start + 1

@theblixguy
Copy link
Collaborator

Simpler reproducer (without UIKit import):

class Base {
  var myProperty: Int? { return nil }
}

class GenericDerived<T>: Base {
  override var myProperty: Int { return 1 }
}

@CodaFi
Copy link
Member

CodaFi commented Feb 25, 2020

Slava's got this one #30054

@slavapestov
Copy link
Member

#30054

@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 SILGen Area → compiler: The SIL generation stage
Projects
None yet
Development

No branches or pull requests

5 participants