Skip to content

Commit ff99444

Browse files
Merge pull request swiftlang#14281 from aschwaighofer/swift-4.1-branch-fix-GetFunctionMetadata-mem-effect
[4.1] IRGen: swift_getFunctionTypeMetadata is not readnone it receive…
2 parents 8c5452b + 688c071 commit ff99444

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ FUNCTION(GetFunctionMetadata, swift_getFunctionTypeMetadata, DefaultCC,
769769
TypeMetadataPtrTy->getPointerTo(0),
770770
Int32Ty->getPointerTo(0),
771771
TypeMetadataPtrTy),
772-
ATTRS(NoUnwind, ReadNone))
772+
ATTRS(NoUnwind))
773773

774774
// Metadata *swift_getFunctionTypeMetadata1(unsigned long flags,
775775
// const Metadata *arg0,

test/Interpreter/closures.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,12 @@ func f() -> Bool? { return nil }
8282
let c = { b = true }
8383
_ = (b, c)
8484
})()
85+
86+
// Don't crash in optimized mode.
87+
func crash() {
88+
let f: (Int, Int, Int, Int) -> Int = { _, _, _, _ in 21 }
89+
let fs = [f, f]
90+
// CHECK: fs: [(Function), (Function)]
91+
print("fs: \(fs)")
92+
}
93+
crash()

0 commit comments

Comments
 (0)