We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
md5: 3406e24f7b253c380c15936e8451fa25
Issue Description:
This used to compile on Swift 5.1, however on 5.2 (and nightly) this crashes
@inlinable public func + <T>(el: T, arr: [T]) -> [T] { var ret = arr ret.insert(el, at: 0) return ret } @inlinable public func cartesianProduct<T>(_ arrays: [T]...) -> [[T]] { guard let head = arrays.first else { return [] } let first = Array(head) func pel( _ el: T, _ ll: [[T]], _ a: [[T]] = [] ) -> [[T]] { switch ll.count { case 0: return a.reversed() case _: let tail = Array(ll.dropFirst()) let head = ll.first! return pel(el, tail, el + head + a) } } return arrays.lazy.reversed() .reduce([first], {res, el in el.flatMap({ pel($0, res) }) }) .map({ $0.dropLast(first.count) }) }
Release compiler error:
1. Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29) 2. While running pass #​361867 SILFunctionTransform "EarlyInliner" on SILFunction "@$s10Playground16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_ADxXEfU_". for expression at [/Users/erik.little/Projects/playground/Sources/Playground/misc.swift:74:45 - line:74:60] RangeText="{ pel($0, res) " 0 swift 0x000000010977e4ea PrintStackTraceSignalHandler(void*) + 42 1 swift 0x000000010977dcc0 SignalHandler(int) + 352 2 libsystem_platform.dylib 0x00007fff68ba142d _sigtramp + 29 3 libsystem_platform.dylib 0x00007f9d0290fa78 _sigtramp + 2580997736 4 swift 0x0000000105c7b7d5 (anonymous namespace)::SILPerformanceInliner::collectAppliesToInline(swift::SILFunction*, llvm::SmallVectorImpl<swift::FullApplySite>&) + 1701 5 swift 0x0000000105c7aae7 (anonymous namespace)::SILPerformanceInlinerPass::run() + 695 6 swift 0x0000000105bdb63d swift::SILPassManager::execute() + 6637 7 swift 0x00000001057ded38 swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) + 7912 8 swift 0x00000001054da980 performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1712 9 swift 0x00000001054d24a5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 55813 10 swift 0x00000001054484d3 main + 1283 11 libdyld.dylib 0x00007fff689a87fd start + 1
Nightly error (according to godbolt https://godbolt.org/z/XveCV3):
SIL verification failed: function_ref inside fragile function cannot reference a private or hidden symbol: (SingleFunction && RefF->isExternalDeclaration()) || RefF->hasValidLinkageForFragileRef() Verifying instruction: -> // function_ref default argument 2 of pel #​1 <A>(_:_:_:) in cartesianProduct<A>(_:) %4 = function_ref @$s6output16cartesianProductySaySayxGGACd_tlF3pelL_yADx_A2DtlFfA1_ : $@convention(thin) <τ_0_0> () -> @owned Array<Array<τ_0_0>> // user: %5 %5 = apply %4<T>() : $@convention(thin) <τ_0_0> () -> @owned Array<Array<τ_0_0>> // users: %8, %7 In function: // closure #​1 in closure #​1 in cartesianProduct<A>(_:) sil shared [serialized] [ossa] @$s6output16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_ADxXEfU_ : $@convention(thin) <T> (@in_guaranteed T, @guaranteed Array<Array<T>>) -> @owned Array<Array<T>> { // %0 // users: %7, %2 // %1 // users: %7, %3 bb0(%0 : $*T, %1 : @guaranteed $Array<Array<T>>): debug_value_addr %0 : $*T, let, name "$0", argno 1 // id: %2 debug_value %1 : $Array<Array<T>>, let, name "res", argno 2 // id: %3 // function_ref default argument 2 of pel #​1 <A>(_:_:_:) in cartesianProduct<A>(_:) %4 = function_ref @$s6output16cartesianProductySaySayxGGACd_tlF3pelL_yADx_A2DtlFfA1_ : $@convention(thin) <τ_0_0> () -> @owned Array<Array<τ_0_0>> // user: %5 %5 = apply %4<T>() : $@convention(thin) <τ_0_0> () -> @owned Array<Array<τ_0_0>> // users: %8, %7 // function_ref pel #​1 <A>(_:_:_:) in cartesianProduct<A>(_:) %6 = function_ref @$s6output16cartesianProductySaySayxGGACd_tlF3pelL_yADx_A2DtlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0, @guaranteed Array<Array<τ_0_0>>, @guaranteed Array<Array<τ_0_0>>) -> @owned Array<Array<τ_0_0>> // user: %7 %7 = apply %6<T>(%0, %1, %5) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0, @guaranteed Array<Array<τ_0_0>>, @guaranteed Array<Array<τ_0_0>>) -> @owned Array<Array<τ_0_0>> // user: %9 destroy_value %5 : $Array<Array<T>> // id: %8 return %7 : $Array<Array<T>> // id: %9 } // end sil function '$s6output16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_ADxXEfU_' Stack dump: 0. Program arguments: /opt/compiler-explorer/swift-nightly/usr/bin/swift -frontend -S -primary-file <source> -target x86_64-unknown-linux-gnu -disable-objc-interop -g -O -Xllvm --x86-asm-syntax=intel -module-name output -o ./output.s 1. Swift version 5.3-dev (LLVM fa328efd5a, Swift 667bec0f21) 2. While evaluating request SILGenSourceFileRequest(SIL Generation for file "<source>") 3. While emitting SIL for 'cartesianProduct(_:)' (at <source>:11:8) 4. While silgen emitFunction SIL function "@$s6output16cartesianProductySaySayxGGACd_tlF". for 'cartesianProduct(_:)' (at <source>:11:8) 5. While silgen closureexpr SIL function "@$s6output16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_". for expression at [<source>:35:21 - line:35:62] RangeText="{res, el in el.flatMap({ pel($0, res) }) " 6. While silgen closureexpr SIL function "@$s6output16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_ADxXEfU_". for expression at [<source>:35:44 - line:35:59] RangeText="{ pel($0, res) " 7. While verifying SIL function "@$s6output16cartesianProductySaySayxGGACd_tlFA2D_ACtXEfU_ADxXEfU_". for expression at [<source>:35:44 - line:35:59] RangeText="{ pel($0, res) "
The text was updated successfully, but these errors were encountered:
@swift-ci create
Sorry, something went wrong.
#31542
No branches or pull requests
Additional Detail from JIRA
md5: 3406e24f7b253c380c15936e8451fa25
Issue Description:
This used to compile on Swift 5.1, however on 5.2 (and nightly) this crashes
Release compiler error:
Nightly error (according to godbolt https://godbolt.org/z/XveCV3):
The text was updated successfully, but these errors were encountered: