It seems like the fix for the EOF processing bug proposed in https://sourceforge.net/p/expect/patches/18/ leads to losing data. The problem arise when some data is already read (cc > 0) but EOF flag is set too. In this case the data is discarded as for now.
There was a long discussion about that in GCC mailing list (where expect is used for testing). It starts here: https://gcc.gnu.org/ml/gcc/2017-06/msg00000.html and the most relevant message, AFAIU, is this one: https://gcc.gnu.org/ml/gcc/2017-07/msg00081.html
A solution is to restore the cc==0 condition together with the existing proper EOF chack. I'm attaching a patch which does just that.
This is now fixed in expect 5.45.4 . Thanks a bundle, will try to add testing for these cases in not too long.