Skip to content

Commit 96910db

Browse files
committed
Enable a test for the SR-15300 bug fix.
"Compiler crash when using Builtin.unreachable in initializers" Move the test into a more general test file for future additions.
1 parent 1b34d14 commit 96910db

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-swift-frontend %s -emit-sil -g -Osize -parse-stdlib -parse-as-library -enable-ossa-modules -o - | %FileCheck %s
2+
3+
// REQUIRES: asserts
4+
5+
import Swift
6+
7+
// Test that DCE correctly preserves debug locations.
8+
// SR-15300: Compiler crash when using Builtin.unreachable in initializers
9+
//
10+
// CHECK: sil_scope [[S1:[0-9]+]] { {{.*}} parent @$s18optimizer_pipeline1AVyACs13KeyValuePairsVyypypGcfC
11+
// CHECK: sil_scope [[S2:[0-9]+]] { {{.*}} parent [[S1]] }
12+
//
13+
// CHECK-LABEL: sil @$s18optimizer_pipeline1AVyACs13KeyValuePairsVyypypGcfC : $@convention(method) (@owned KeyValuePairs<Any, Any>, @thin A.Type) -> A {
14+
// CHECK: bb0(%0 : $KeyValuePairs<Any, Any>, %1 : $@thin A.Type):
15+
// CHECK: unreachable , scope [[S2]]
16+
// CHECK-LABEL: } // end sil function '$s18optimizer_pipeline1AVyACs13KeyValuePairsVyypypGcfC'
17+
public struct A {
18+
public init(_ pairs: KeyValuePairs<Any, Any>) {
19+
Builtin.unreachable()
20+
}
21+
}

test/SIL/crash-sr-15300.swift

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)