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-6734] "unimplemented lvalue expr" when combining redundant try! and inout #49283

Open
swift-ci opened this issue Jan 11, 2018 · 1 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 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-6734
Radar rdar://problem/36440036
Original Reporter comex (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee None
Priority Medium

md5: 7e37a03aa6b2fda499635a059ae28180

Issue Description:

func bad(a: inout Int) throws {
    let b = try! a
}

Crash when trying to compile the above. It doesn't matter whether `throws` is there, but removing `inout` prevents the crash.

Output:

@ /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-01-10-a.xctoolchain/usr/bin/swiftc  testing2.playground/Contents.swift
testing2.playground/Contents.swift:2:9: warning: initialization of immutable value 'b' was never used; consider replacing with assignment to '_' or removing it
    let b = try! a
    ~~~~^
    _
testing2.playground/Contents.swift:2:18: warning: no calls to throwing functions occur within 'try' expression
    let b = try! a
                 ^
(force_try_expr type='@lvalue Int' accessKind=read location=testing2.playground/Contents.swift:2:18 range=[testing2.playground/Contents.swift:2:13 - line:2:18]
  (declref_expr type='@lvalue Int' accessKind=read location=testing2.playground/Contents.swift:2:18 range=[testing2.playground/Contents.swift:2:18 - line:2:18] decl=Contents.(file).bad(a:).a@testing2.playground/Contents.swift:1:10 function_ref=unapplied))
unimplemented lvalue expr
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenLValue.cpp:2078!
0  swift                    0x0000000106dedb78 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x0000000106decac6 llvm::sys::RunSignalHandlers() + 86
2  swift                    0x0000000106dee13e SignalHandler(int) + 366
3  libsystem_platform.dylib 0x00007fff5f5e1f5a _sigtramp + 26
4  swift                    0x0000000107ac89c0 (anonymous namespace)::DarwinX86AsmBackend::getCompactUnwindRegNum(unsigned int) const::CU64BitRegs + 235162
5  libsystem_c.dylib        0x00007fff5f38c1ae abort + 127
6  swift                    0x0000000106d8e9c0 LLVMInstallFatalErrorHandler + 0
7  swift                    0x0000000104068cb1 SILGenLValue::visitExpr(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 49
8  swift                    0x00000001040681e7 swift::ASTVisitor<SILGenLValue, swift::Lowering::LValue, void, void, void, void, void, swift::AccessKind, swift::Lowering::LValueOptions>::visit(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 471
9  swift                    0x0000000104067f4e swift::Lowering::SILGenFunction::emitLValue(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 46
10 swift                    0x00000001040385b1 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 81
11 swift                    0x0000000104027e62 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 290
12 swift                    0x0000000104027f9d swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
13 swift                    0x00000001040a3d4c swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 396
14 swift                    0x00000001040a3bb5 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
15 swift                    0x000000010405fa60 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 464
16 swift                    0x0000000103fdf29f swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 287
17 swift                    0x0000000103fd6f97 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 647
18 swift                    0x0000000103fdbe3b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 763
19 swift                    0x0000000103fdcad1 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 353
20 swift                    0x0000000103fdd0ca swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 122
21 swift                    0x0000000103937758 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 9832
22 swift                    0x00000001039340ea swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3210
23 swift                    0x00000001038f4fc0 main + 3360
24 libdyld.dylib            0x00007fff5f2e0021 start + 1
25 libdyld.dylib            0x000000000000000d start + 2698117101
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-01-10-a.xctoolchain/usr/bin/swift -frontend -c -primary-file testing2.playground/Contents.swift -target x86_64-apple-darwin17.5.0 -enable-objc-interop -color-diagnostics -module-name Contents -o /var/folders/4l/wmcvw6_x6rb6tgdbyjn67w400000gn/T/Contents-8368f8.o 
1.  While emitting SIL for 'bad(a:)' at testing2.playground/Contents.swift:1:1
2.  While silgen emitFunction SIL function "@$S8Contents3bad1aySiz_tKF".
 for 'bad(a:)' at testing2.playground/Contents.swift:1:1
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
@belkadan
Copy link
Contributor

@swift-ci create

@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
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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants