Fix thread-alloca test on Windows.

Invoke gcc in a more portable fashion.
Flush streams more precisely.

The test for the space left in the stream buffer was too conservative,
leaving 1 byte unused.
Patch by Ken Olum.
Fixes lp#910213.