https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98129
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #6 from kargl at gcc dot gnu.org --- (In reply to Thomas Koenig from comment #5) > Question... on your respective systems, could you strace or truss it and find > if there is a short read? > > On Linux, there seems to be a limitation of how many bytes > a read from /dev/urandom returns, and we assume that this is > an end of file. > > However, this is not correct - we can only safely assume eof if > read() returns zero bytes. Well, the test completes so I would expect that there isn't a short read. I modified the program to write to 'txt.dat' and get the expected file sizes for various 'n = 10**m' values. FreeBSD does not have strace, but ktrace suggests that the read/write occur as expected. Looking at the FreeBSD manpage, I find The /dev/urandom interface returns bytes regardless of the amount of entropy available. It does not block on a read request due to lack of entropy. Does urandom block on your system, and is this interpreted as a short read?