File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
validation-test/compiler_crashers_fixed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -614,3 +614,31 @@ bb3:
614
614
%8 = tuple ()
615
615
return %8 : $()
616
616
}
617
+
618
+ struct YYY<T> {
619
+ }
620
+
621
+ enum MyOptional<T> {
622
+ case none
623
+ case some(T)
624
+ }
625
+
626
+ // Check that a specialization of a self-recursive function is produced
627
+ // and it is not crashing the compiler.
628
+ // CHECK-LABEL: sil shared @_T025testSelfRecursiveFunction4main10MyOptionalOyAB3YYYVyypGG_Tg5 : $@convention(thin) (MyOptional<YYY<Any>>) -> ()
629
+ sil @testSelfRecursiveFunction : $@convention(thin) <T> (@in T) -> () {
630
+ bb0(%0 : $*T):
631
+ %2 = function_ref @testSelfRecursiveFunction : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
632
+ %3 = alloc_stack $MyOptional<YYY<Any>>
633
+ inject_enum_addr %3 : $*MyOptional<YYY<Any>>, #MyOptional.none!enumelt
634
+ %5 = tuple ()
635
+ %6 = load %3 : $*MyOptional<YYY<Any>>
636
+ %7 = alloc_stack $MyOptional<YYY<Any>>
637
+ store %6 to %7 : $*MyOptional<YYY<Any>>
638
+ %9 = apply %2<MyOptional<YYY<Any>>>(%7) : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
639
+ dealloc_stack %7 : $*MyOptional<YYY<Any>>
640
+ dealloc_stack %3 : $*MyOptional<YYY<Any>>
641
+ destroy_addr %0 : $*T
642
+ %13 = tuple ()
643
+ return %13 : $()
644
+ } // end sil function 'testSelfRecursiveFunction'
Original file line number Diff line number Diff line change 4
4
//
5
5
// See https://swift.org/LICENSE.txt for license information
6
6
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7
- // RUN: not --crash %target-swift-frontend -primary-file %s -emit-ir -O
7
+ // RUN: %target-swift-frontend -primary-file %s -emit-ir -O
8
8
// non-fuzz (@dusek)
9
9
10
10
func f< T> ( _ a: T ) -> Void { f ( nil as [ Any ] ? ) }
You can’t perform that action at this time.
0 commit comments