You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
macOS
swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) (Xcode 9.2)
The code above causes a compiler crash.
It has been reproduced on:
swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) (Xcode 9.2)
Invocation:
swiftc -swift-version 4 Crasher.swift or swiftc -swift-version 3 Crasher.swift
Note:
If the nestedA(nestedB) is moved outside of the guard we instead get an error:
error: variable used within its own initial value
nestedA(nestedB)
Callstack
:> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain/usr/bin/swiftc -v -swift-version 4 Crasher.swift
Apple Swift version 4.1-dev (LLVM c4ec2ab808, Clang d8b11579e8, Swift c8e37242fe)
Target: x86_64-apple-darwin17.4.0
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain/usr/bin/swift -frontend -c -primary-file Crasher.swift -target x86_64-apple-darwin17.4.0 -enable-objc-interop -swift-version 4 -color-diagnostics -module-name Crasher -o /var/folders/0l/kr96lmsd1wgbnq21nftllcwh0000gp/T/Crasher-ccdd6b.o
Assertion failed: (found != VarLocs.end()), function emitCaptures, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenFunction.cpp, line 199.
0 swift 0x000000010d82a7e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010d82aef6 SignalHandler(int) + 694
2 libsystem_platform.dylib 0x00007fff77f92f5a _sigtramp + 26
3 libsystem_platform.dylib 0x00000001105f6568 _sigtramp + 2556835368
4 libsystem_c.dylib 0x00007fff77dbd312 abort + 127
5 libsystem_c.dylib 0x00007fff77d85368 basename_r + 0
6 swift 0x000000010a9b8245 swift::Lowering::SILGenFunction::emitCaptures(swift::SILLocation, swift::AnyFunctionRef, swift::Lowering::CaptureEmission, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&) + 3845
7 swift 0x000000010a9b8617 swift::Lowering::SILGenFunction::emitClosureValue(swift::SILLocation, swift::SILDeclRef, swift::CanType, llvm::ArrayRef<swift::Substitution>) + 839
8 swift 0x000000010a9a9f01 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 241
9 swift 0x000000010a99c8f3 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 115
10 swift 0x000000010a991bef swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 335
11 swift 0x000000010a981054 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 292
12 swift 0x000000010a9812ad swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
13 swift 0x000000010aa02677 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8711
14 swift 0x000000010aa00465 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
15 swift 0x000000010a9b8c9d swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 509
16 swift 0x000000010a939327 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 311
17 swift 0x000000010a93169b swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 875
18 swift 0x000000010a93612b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 811
19 swift 0x000000010a936ee0 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 352
20 swift 0x000000010a9374ea swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 122
21 swift 0x000000010a2712c5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 10197
22 swift 0x000000010a26db65 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3365
23 swift 0x000000010a224a62 main + 3042
24 libdyld.dylib 0x00007fff77d11115 start + 1
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain/usr/bin/swift -frontend -c -primary-file Crasher.swift -target x86_64-apple-darwin17.4.0 -enable-objc-interop -swift-version 4 -color-diagnostics -module-name Crasher -o /var/folders/0l/kr96lmsd1wgbnq21nftllcwh0000gp/T/Crasher-ccdd6b.o
1. While emitting SIL for 'afunc()' at Crasher.swift:1:1
2. While silgen emitFunction SIL function "@$S7Crasher5afuncyyF".
for 'afunc()' at Crasher.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)
The text was updated successfully, but these errors were encountered:
spestov@Slavas-iMac-Pro ~/s/swift> xcrun ../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swiftc e.swift
e.swift:7:21: error: variable declared in 'guard' condition is not usable in its body
nestedA(nestedB)
^
In case it is useful, the error message above is still same.
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
Target: x86_64-apple-darwin18.7.0
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file SR-7055.swift -target x86_64-apple-darwin18.7.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -color-diagnostics -module-name main -o SR-7055.o
SR-7055.swift:7:21: error: variable declared in 'guard' condition is not usable in its body
nestedA(nestedB)
Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
Target: x86_64-apple-darwin19.6.0
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file SR-7055.swift -target x86_64-apple-darwin19.6.0 -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -color-diagnostics -target-sdk-version 10.15.6 -module-name main -o SR-7055.o
SR-7055.swift:7:21: error: variable declared in 'guard' condition is not usable in its body
nestedA(nestedB)
^
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
SR-7055.swift:5:37: error: closure captures 'nestedB' before it is declared
let nestedB: (Error?) -> Void = { (error) in
^
SR-7055.swift:5:9: note: captured value declared here
let nestedB: (Error?) -> Void = { (error) in
^
SR-7055.swift:7:21: note: captured here
nestedA(nestedB)
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Environment
macOS
swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) (Xcode 9.2)
Additional Detail from JIRA
md5: ce65ae04a96a7b4e71fd20ad8664715d
Issue Description:
The code above causes a compiler crash.
It has been reproduced on:
swift-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain
Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2) (Xcode 9.2)
Invocation:
swiftc -swift-version 4 Crasher.swift or swiftc -swift-version 3 Crasher.swift
Note:
If the nestedA(nestedB) is moved outside of the guard we instead get an error:
Callstack
The text was updated successfully, but these errors were encountered: