https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102259
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Michel Morin from comment #2) > Whoa, darwin's (and FreeBSD's too?) `read(…, …, nbyte)` fails when nbyte >= > 2^31! This is the culprit, I think. > > I also found the following description in FreeBSD's manpage of read > (https://www.unix.com/man-page/FreeBSD/2/read/): > > ERRORS > [EINVAL] The value nbytes is greater than INT_MAX. > > Given that the testcase works file when compiled with Clang, libcxx would > have some workround for it. Maybe they do a loop around the read for sizes >= INT_MAX. I don't know if that is the correct thing to do or not.