Possible toolchain bug with handling return value of read()