Mysterious type error from C compiler