Skip to content

Commit

Permalink
add a test case for an invalid optimizatio
Browse files Browse the repository at this point in the history
A recent optimization was overly aggressive and resulted in a miscompile
in FoundationNetworking. Add a test case.
  • Loading branch information
compnerd committed Sep 3, 2020
1 parent 11f0f6e commit cf8e32d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Foundation
import FoundationNetworking

let url = URL(string: "http://swift.org")!
let data = try! Data(contentsOf: url)
print(data.underestimatedCount)
8 changes: 8 additions & 0 deletions test-foundation-package/test-foundation-networking-fetch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
REQUIRES: platform=Linux

RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -o %t/test-foundation-networking-fetch %S/test-foundation-networking-fetch.swift
RUN: %t/test-foundation-networking-fetch | %{FileCheck} %s

CHECK: {{[0-9]+}}

0 comments on commit cf8e32d

Please sign in to comment.