Fix raw_fd_ostream::write_impl hang with large output
authorJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 26 Jul 2018 13:22:07 +0000 (13:22 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 26 Jul 2018 13:22:07 +0000 (13:22 +0000)
commite2e4a6c6307482dd11333e805dfb82837de2c656
tree24b9abf1b5c730c2cb39e17cec82477887863e8b
parentfac87b3dd7f4e27cd4d5dcdddf0d9ade4a9a2ac4
Fix raw_fd_ostream::write_impl hang with large output

On Windows when raw_fd_ostream::write_impl calls write, a 32 bit input
is required for character count. As a variable with size_t is used for
this argument on x64 integral demotion occurs. In the case of large
files an infinite loop follows.

See PR37926.

This fix allows the output of files larger than previous int32 limit.

Differential Revision: https://reviews.llvm.org/D48948

Patch by Owen Reynolds

Reviewed by: zturner

llvm-svn: 338027
llvm/lib/Support/raw_ostream.cpp