http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56180
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-03 09:22:05 UTC --- When you were calling ungetc with uninitialized char, that is invoking undefined behavior, anything can happen at that point.