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-9375] base value of open-existential component was not an address? #51841

Closed
swift-ci opened this issue Nov 29, 2018 · 6 comments
Closed
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

@swift-ci
Copy link
Collaborator

Previous ID SR-9375
Radar rdar://problem/46343977
Original Reporter linqingmo (JIRA User)
Type Bug
Status Closed
Resolution Done
Environment

Swift Development Snapshot 2018-11-28 (a)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression, CompilerCrash
Assignee None
Priority Medium

md5: 6c26728fa13ecfdc9ee91f7d0986fe52

Issue Description:

Project: line-sdk-ios-swift

LineSDK/LineSDK/Login/LoginManager.swift can't compile.

completion(.failure(errors[0].sdkError)) // line 199 crashes

let error = errors[0]
completion(.failure(error.sdkError)) // is OK
@belkadan
Copy link
Contributor

Aside: If you're already testing this with master, what do you think about adding it to the source compatibility suite?

@onevcat
Copy link
Contributor

onevcat commented Dec 3, 2018

We made a change to our source code to let it compile: line/line-sdk-ios-swift@1681109

However, there should be definitely a fix in Swift compiler for it.

A pull request was also sent to the source compatibility suite, with a commit before the workaround above: apple/swift-source-compat-suite#295

@lorentey
Copy link
Member

lorentey commented Dec 3, 2018

   Assertion failed: (base.getType().isAddress() && "base value of open-existential component was not an address?"), function project, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenLValue.cpp, line 847.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-12-02-a.xctoolchain/usr/bin/swift [...] 
1.  While emitting SIL for 'postLogin(token:response:process:completionHandler:)' (at /tmp/line-sdk-ios-swift/LineSDK/LineSDK/Login/LoginManager.swift:169:5)
2.  While silgen emitFunction SIL function "@$s7LineSDK12LoginManagerC04postC05token8response7process17completionHandleryAA11AccessTokenV_AA0C18ProcessURLResponseVAA0cM0CyAA6ResultOyAA0cO0VAA0A8SDKErrorOGctF".
 for 'postLogin(token:response:process:completionHandler:)' (at /tmp/line-sdk-ios-swift/LineSDK/LineSDK/Login/LoginManager.swift:169:5)
3.  While silgen closureexpr SIL function "@$s7LineSDK12LoginManagerC04postC05token8response7process17completionHandleryAA11AccessTokenV_AA0C18ProcessURLResponseVAA0cM0CyAA6ResultOyAA0cO0VAA0A8SDKErrorOGctFyycfU1_".
 for expression at [/tmp/line-sdk-ios-swift/LineSDK/LineSDK/Login/LoginManager.swift:197:36 - line:227:9] RangeText="{
            guard errors.isEmpty else {
                completion(.failure(errors[0].sdkError))
                return
            }
            
            if let key = webToken {
                do {
                    try self.verifyIDToken(token.IDToken!, key: key, process: process, userID: profile?.userID)
                } catch {
                    if let cryptoError = error as? CryptoError {
                        completion(.failure(.authorizeFailed(reason: .cryptoError(error: cryptoError))))
                    } else {
                        completion(.failure(error.sdkError))
                    }
                    return
                }
            }
            
            // Everything goes fine now. Store token.
            let result = Result {
                try AccessTokenStore.shared.setCurrentToken(token)
            }.map {
                LoginResult.init(
                    accessToken: token,
                    permissions: Set(token.permissions),
                    userProfile: profile,
                    friendshipStatusChanged: response.friendshipStatusChanged)
            }
            completion(result)
        "
0  swift                    0x000000010baba618 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010bab9895 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010babac22 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff6f29bb5d _sigtramp + 29
4  libsystem_platform.dylib 0x000000010df93938 _sigtramp + 2664398328
5  libsystem_c.dylib        0x00007fff6f15a686 abort + 127
6  libsystem_c.dylib        0x00007fff6f1230ed basename_r + 0
7  swift                    0x0000000108813405 (anonymous namespace)::OpenOpaqueExistentialComponent::project(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue) && + 1045
8  swift                    0x00000001087ffb03 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 483
9  swift                    0x00000001087dbe35 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 6837
10 swift                    0x00000001087cf289 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
11 swift                    0x00000001087fd3d6 SILGenLValue::visitRec(swift::Expr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions, swift::Lowering::AbstractionPattern) + 886
12 swift                    0x0000000108801282 SILGenLValue::visitMemberRefExpr(swift::MemberRefExpr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions) + 642
13 swift                    0x00000001087fccb7 swift::ASTVisitor<SILGenLValue, swift::Lowering::LValue, void, void, void, void, void, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions>::visit(swift::Expr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions) + 231
14 swift                    0x00000001087fcaaa swift::Lowering::SILGenFunction::emitLValue(swift::Expr*, swift::Lowering::SGFAccessKind, swift::Lowering::LValueOptions) + 58
15 swift                    0x00000001087deb55 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 18389
16 swift                    0x00000001087e8d69 void llvm::function_ref<void (swift::Expr*)>::callback_fn<swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16)::'lambda'(swift::Expr*)>(long, swift::Expr*) + 41
17 swift                    0x00000001087d9059 swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 201
18 swift                    0x00000001087e8cb1 swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16) + 65
19 swift                    0x00000001087db140 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 3520
20 swift                    0x00000001087dc639 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 8889
21 swift                    0x00000001087cc00f swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 303
22 swift                    0x0000000108749959 swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::Initialization*) && + 217
23 swift                    0x000000010874a44c swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 540
24 swift                    0x000000010878efc8 void llvm::function_ref<void (swift::SILValue)>::callback_fn<swift::Lowering::SILGenFunction::emitInjectEnum(swift::SILLocation, swift::Lowering::ArgumentSource, swift::SILType, swift::EnumElementDecl*, swift::Lowering::SGFContext)::$_4>(long, swift::SILValue) + 968
25 swift                    0x000000010879cce4 swift::Lowering::SILGenBuilder::bufferForExpr(swift::SILLocation, swift::SILType, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext, llvm::function_ref<void (swift::SILValue)>) + 260
26 swift                    0x0000000108770562 swift::Lowering::SILGenFunction::emitInjectEnum(swift::SILLocation, swift::Lowering::ArgumentSource, swift::SILType, swift::EnumElementDecl*, swift::Lowering::SGFContext) + 1762
27 swift                    0x00000001087725ca (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 5194
28 swift                    0x0000000108771080 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 2016
29 swift                    0x00000001087da3d0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 80
30 swift                    0x00000001087cf289 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
31 swift                    0x00000001087817a7 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2551
32 swift                    0x000000010877b079 (anonymous namespace)::ArgEmitter::emitTopLevel(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5881
33 swift                    0x000000010878d5b7 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 1047
34 swift                    0x000000010878ccbc (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1756
35 swift                    0x0000000108771d56 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3030
36 swift                    0x0000000108771080 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 2016
37 swift                    0x00000001087da3d0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 80
38 swift                    0x00000001087cf7ee swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 1198
39 swift                    0x000000010883e30c swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8652
40 swift                    0x000000010883cc71 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 2865
41 swift                    0x000000010883e23c swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8444
42 swift                    0x000000010883c135 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
43 swift                    0x00000001087f2e6e swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 286
44 swift                    0x00000001087626b6 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 278
45 swift                    0x00000001087e7418 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 40
46 swift                    0x00000001087da3f0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 112
47 swift                    0x00000001087cf289 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
48 swift                    0x00000001087df7b0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 21552
49 swift                    0x00000001087cf289 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
50 swift                    0x0000000108781814 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2660
51 swift                    0x00000001087825bd (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 669
52 swift                    0x0000000108780e26 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 118
53 swift                    0x000000010877af11 (anonymous namespace)::ArgEmitter::emitTopLevel(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5521
54 swift                    0x000000010878d5b7 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 1047
55 swift                    0x000000010878ccbc (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1756
56 swift                    0x0000000108771d56 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3030
57 swift                    0x0000000108771080 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 2016
58 swift                    0x00000001087da3d0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 80
59 swift                    0x00000001087cf7ee swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 1198
60 swift                    0x000000010883e30c swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8652
61 swift                    0x000000010883c135 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
62 swift                    0x00000001087f264a swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 426
63 swift                    0x0000000108769ced swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 237
64 swift                    0x0000000108760cd2 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 642
65 swift                    0x00000001088483d5 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 21
66 swift                    0x0000000108846b7f (anonymous namespace)::SILGenType::emitType() + 239
67 swift                    0x0000000108846a89 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
68 swift                    0x00000001087661b6 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 822
69 swift                    0x00000001087670c6 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 294
70 swift                    0x000000010876765c swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&) + 44
71 swift                    0x0000000107ef229e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 7406
72 swift                    0x0000000107eef542 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2978
73 swift                    0x0000000107ea136e main + 686
74 libdyld.dylib            0x00007fff6f0b43f1 start + 1
75 libdyld.dylib            0x00000000000000c3 start + 2431958227
error: Abort trap: 6

@aschwaighofer
Copy link
Member

Should be fixed by: #21296

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

linqingmo (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@onevcat
Copy link
Contributor

onevcat commented Jul 23, 2019

Yes, I can confirm this was already fixed and please feel free to move it to "Closed". Thanks for your hard work!

@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

6 participants