Arm64/ppc64le segfaults

I get reproducible segfaults in getc(stdin) when stdin is a fifo accessed like this:

mkfifo fifo
exec 8<>fifo
echo asdf >fifo
rm fifo
./a-program-calling-getc <&8

This segfaults on arm64 and ppc64le, both on xenial and bionic, both with gcc and clang. amd64, both linux and osx, and s390x are unaffected. FWIW, read(0, ...) doesn’t segfault, but it doesn’t read what it was supposed to, either.

Fairly minimal example:
https://travis-ci.org/szeder/git/builds/617513593
https://travis-ci.org/szeder/git/builds/617513614

Imprint