Skip to content

Commit cf8e32d

Browse files
committed
add a test case for an invalid optimizatio
A recent optimization was overly aggressive and resulted in a miscompile in FoundationNetworking. Add a test case.
1 parent 11f0f6e commit cf8e32d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Foundation
2+
import FoundationNetworking
3+
4+
let url = URL(string: "http://swift.org")!
5+
let data = try! Data(contentsOf: url)
6+
print(data.underestimatedCount)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
REQUIRES: platform=Linux
2+
3+
RUN: rm -rf %t
4+
RUN: mkdir -p %t
5+
RUN: %{swiftc} -o %t/test-foundation-networking-fetch %S/test-foundation-networking-fetch.swift
6+
RUN: %t/test-foundation-networking-fetch | %{FileCheck} %s
7+
8+
CHECK: {{[0-9]+}}

0 commit comments

Comments
 (0)