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
BradLarson opened this issue
Oct 14, 2021
· 1 comment
Labels
assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareSILswift 5.6verifier
If you place the definition of a nested function after a return that passes on a value returned by that nested function, a SIL verification failure results: "external declaration of internal SILFunction not allowed: F->isAvailableExternally()". This does not appear to be a recent regression, as it fails with all of the various toolchains I have on hand.
To reproduce, place the following simple code in a file
func testFunc(_ value:Int)->Int{returntestFunc2(value)func testFunc2(_ value:Int)->Int{return value *2}}
Building triggers the following failure:
SIL verification failed: external declaration of internal SILFunction not allowed: F->isAvailableExternally()
In function:
// testFunc2 #​1 (_:) in testFunc(_:)
sil private @$s21NestedFunctionCrasher8testFuncyS2iF0D5Func2L_yS2iF : $@convention(thin) (Int) -> Int
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-10-05-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file NestedFunctionCrasher.swift -target x86_64-apple-macosx11.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -color-diagnostics -new-driver-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-10-05-a.xctoolchain/usr/bin/swift-driver -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-10-05-a.xctoolchain/usr/lib/swift -module-name NestedFunctionCrasher -target-sdk-version 11.3.0 -o /var/folders/1s/z_s04yq55wq2jvgqghm8zm7w0000gp/T/TemporaryDirectory.R9kI74/NestedFunctionCrasher-1.o
1. Apple Swift version 5.6-dev (LLVM 7aef0efea99e2c6, Swift e4f71c8e118fc09)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "NestedFunctionCrasher.swift")
4. While verifying SIL function "@$s21NestedFunctionCrasher8testFuncyS2iF0D5Func2L_yS2iF".
for 'testFunc2(_:)' (at NestedFunctionCrasher.swift:4:3)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x00000001076bd8f7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1 swift-frontend 0x00000001076bcb15 llvm::sys::RunSignalHandlers() + 85
2 swift-frontend 0x00000001076be146 SignalHandler(int) + 278
3 libsystem_platform.dylib 0x00007fff2040cd7d _sigtramp + 29
4 libsystem_platform.dylib 0x000000011405354b _sigtramp + 18446603344605898731
5 libsystem_c.dylib 0x00007fff2031c406 abort + 125
6 swift-frontend 0x0000000102f7baae (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 1358
7 swift-frontend 0x0000000102f7c449 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 601
8 swift-frontend 0x0000000102f7ae83 swift::SILModule::verify() const + 275
9 swift-frontend 0x0000000103328584 swift::Lowering::SILGenModule::~SILGenModule() + 36
10 swift-frontend 0x000000010333281f swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 5391
11 swift-frontend 0x00000001034015f6 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 134
12 swift-frontend 0x000000010333637d llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 413
13 swift-frontend 0x0000000103332ae4 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&) + 116
14 swift-frontend 0x0000000102cd8d1a performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 618
15 swift-frontend 0x0000000102ccdc82 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4850
16 swift-frontend 0x0000000102c95cd2 swift::mainEntry(int, char const**) + 546
17 libdyld.dylib 0x00007fff203e2f3d start + 1
18 libdyld.dylib 0x0000000000000015 start + 18446603339975217369
The text was updated successfully, but these errors were encountered:
assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareSILswift 5.6verifier
Additional Detail from JIRA
md5: 81dcda5e22e46ceb37d6783cfd9cc555
Issue Description:
If you place the definition of a nested function after a return that passes on a value returned by that nested function, a SIL verification failure results: "external declaration of internal SILFunction not allowed: F->isAvailableExternally()". This does not appear to be a recent regression, as it fails with all of the various toolchains I have on hand.
To reproduce, place the following simple code in a file
Building triggers the following failure:
The text was updated successfully, but these errors were encountered: