base: Fix fdReady() potentially running forever for Windows Char devices.
ClosedPublic

Authored by nh2 on Sep 14 2017, 8:48 AM.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nh2 created this revision.Sep 14 2017, 8:48 AM
nh2 added inline comments.Sep 14 2017, 11:30 AM
libraries/base/cbits/inputReady.c
124–128

I don't think this is correct as is, WaitForSingleObject takes DWORD (unsigned) an below remaining = endTime - now can easily become negative.

Not sure why I didn't get a narrowing warning.

nh2 updated this revision to Diff 13890.Sep 14 2017, 11:45 AM

Fix overflow of remaining when calling WaitForSingleObject

nh2 marked an inline comment as done.Sep 14 2017, 11:45 AM
nh2 added a comment.Sep 14 2017, 12:57 PM

Not sure why I didn't get a narrowing warning.

Because apparently none of -Wall, -Wextra or -pedantic imply -Wconversion or its subset -Wsign-conversion in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51625

bgamari accepted this revision.Sep 14 2017, 2:51 PM

Looks right to me.

This revision is now accepted and ready to land.Sep 14 2017, 2:51 PM
This revision was automatically updated to reflect the committed changes.