The PCRE tests (specifically RunGrepTest) fail under msys2/mingw-w64 because it (pcregrep.c) assumes that fprintf(stdout,"\n") results in a simple unix newline getting written to stdout. However, the default behavior of windows is to instead write \r\n. I'm not quite sure who is most at fault there.
We patch bash and other programs to replace windows line endings with unix line endings because most MSYS tools give wrong result when they meet \r\n. I think this issue cannot be resolved now.