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-13227] Error on build unowned with optional #55667

Closed
swift-ci opened this issue Jul 15, 2020 · 5 comments
Closed

[SR-13227] Error on build unowned with optional #55667

swift-ci opened this issue Jul 15, 2020 · 5 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-13227
Radar rdar://problem/65751793
Original Reporter qRoC (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

CMake + Swift 5.2 (from XCode 11)

CMake + Swift 5.3 (from XCode 12)

XCode Beta 12 Playgrounds

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

Watchers: @shahmishal

md5: d504936227168e16ec49f521eb6c341e

Issue Description:

Test code:

class Class {}
public struct Test<T: AnyObject> {
    internal unowned let t: Class!

    public init() {
        self.t = nil
    }
}

Ok

public struct Test<T: AnyObject> {
    internal unowned(unsafe) let t: T!

    public init() {
        self.t = nil
    }
}

Ok

public struct Test<T: AnyObject> {
    internal unowned let t: T!

    public init() {
        self.t = nil
    }
}

Result:

Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file ../../Libraries/TestFail/Sources/TestFail/Test.swift  -emit-module-path Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.swiftmodule -emit-module-doc-path Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.swiftdoc -emit-module-source-info-path Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.swiftsourceinfo -emit-dependencies-path Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.o.d -emit-reference-dependencies-path Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.o.swiftdeps -target x86_64-apple-darwin19.5.0 -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I .build/swift -g -module-link-name TestFail -D TestFail_EXPORTS -enable-anonymous-context-mangled-names -target-sdk-version 10.15.4 -parse-as-library -module-name TestFail -o Libraries/TestFail/CMakeFiles/TestFail.dir/Sources/TestFail/Test.swift.o 
1.  Apple Swift version 5.3 (swiftlang-1200.0.16.9 clang-1200.0.22.5)
2.  While evaluating request SILGenSourceFileRequest(SIL Generation for file "../../Libraries/TestFail/Sources/TestFail/Test.swift")
3.  While emitting SIL for getter for t (at ../../Libraries/TestFail/Sources/TestFail/Test.swift:45:26)
0  swift                    0x00000001054bdf65 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x00000001054bcf65 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x00000001054be51f SignalHandler(int) + 111
3  libsystem_platform.dylib 0x00007fff6f1d75fd _sigtramp + 29
4  libsystem_platform.dylib 0x00007fdb1d861b10 _sigtramp + 18446743917721855280
5  swift                    0x000000010238d735 swift::UnownedStorageType::isLoadable(swift::ResilienceExpansion) const + 181
6  swift                    0x0000000101c37c0f swift::CanTypeVisitor<(anonymous namespace)::TypeClassifier, swift::Lowering::TypeLowering::RecursiveProperties, swift::Lowering::AbstractionPattern>::visit(swift::CanType, swift::Lowering::AbstractionPattern) + 2079
7  swift                    0x0000000101c3b3ea (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::Lowering::AbstractionPattern, swift::StructDecl*) + 426
8  swift                    0x0000000101c30c87 swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type, swift::TypeExpansionContext) + 1015
9  swift                    0x0000000101bbf6d4 (anonymous namespace)::DestructureInputs::visit(swift::ValueOwnership, bool, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILFunctionTypeRepresentation, bool) + 452
10 swift                    0x0000000101bbd82d getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::AnyFunctionType::ExtInfo, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, llvm::Optional<swift::SILDeclRef>, llvm::Optional<swift::SILDeclRef>, llvm::Optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 2109
11 swift                    0x0000000101bb850c getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::AnyFunctionType::ExtInfo, llvm::Optional<swift::SILDeclRef>, llvm::Optional<swift::SILDeclRef>, llvm::Optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 1724
12 swift                    0x0000000101bb97b9 getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::CanTypeWrapper<swift::AnyFunctionType>) + 1625
13 swift                    0x0000000101bba0fc swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 1148
14 swift                    0x0000000101bb21e1 swift::SILFunctionBuilder::getOrCreateFunction(swift::SILLocation, swift::SILDeclRef, swift::ForDefinition_t, llvm::function_ref<swift::SILFunction* (swift::SILLocation, swift::SILDeclRef)>, swift::ProfileCounter) + 145
15 swift                    0x00000001014c3123 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 467
16 swift                    0x00000001014c468e swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 846
17 swift                    0x00000001015db238 void llvm::function_ref<void (swift::AccessorDecl*)>::callback_fn<(anonymous namespace)::SILGenType::visitAccessors(swift::AbstractStorageDecl*)::'lambda'(swift::AccessorDecl*)>(long, swift::AccessorDecl*) + 24
18 swift                    0x00000001022505ab swift::AbstractStorageDecl::visitExpectedOpaqueAccessors(llvm::function_ref<void (swift::AccessorKind)>) const + 219
19 swift                    0x00000001015db211 (anonymous namespace)::SILGenType::visitVarDecl(swift::VarDecl*) + 977
20 swift                    0x00000001015d5b0b (anonymous namespace)::SILGenType::emitType() + 427
21 swift                    0x00000001014cf2a2 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 82
22 swift                    0x00000001014cd5c9 (anonymous namespace)::SILGenModuleRAII::emitSourceFile(swift::SourceFile*) + 1417
23 swift                    0x00000001014ccf89 swift::SILGenSourceFileRequest::evaluate(swift::Evaluator&, swift::SILGenDescriptor) const + 137
24 swift                    0x00000001015c7c41 swift::SimpleRequest<swift::SILGenSourceFileRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::SILGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::SILGenSourceFileRequest const&, swift::Evaluator&) + 33
25 swift                    0x00000001014d3dbc llvm::Expected<swift::SILGenSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::SILGenSourceFileRequest>(swift::SILGenSourceFileRequest const&) + 972
26 swift                    0x00000001014cee1d swift::performSILGeneration(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&) + 173
27 swift                    0x00000001010414bf swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 20639
28 swift                    0x0000000100fc2a97 main + 1255
29 libdyld.dylib            0x00007fff6efdecc9 start + 1
30 libdyld.dylib            0x0000000000000025 start + 18446603338654028637
<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: compile command failed due to signal 4 (use -v to see invocation)
ninja: build stopped: subcommand failed.
@theblixguy
Copy link
Collaborator

#32927

@theblixguy
Copy link
Collaborator

Fixed on master and I’ve also cherry-picked the fix to [5.3| #32949]. Please verify using the next available snapshot.

@airspeedswift
Copy link
Member

@swift-ci create

1 similar comment
@shahmishal
Copy link
Member

@swift-ci create

@shahmishal
Copy link
Member

Re-opening Jira to sync to radar

@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