[Bug c/56180] Strange behaviour with optimization (using K&R C)

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 2 11:15:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56180

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-02 11:15:22 UTC ---
And, even if ungetc works for more than one character (e.g. in glibc it will
often work if you are calling ungetc with the characters that fgetc etc.
returned from the stream, in reverse order, plus the one guaranteed unrelated
ungetc),
the
        /* If we were just checking ahead, unget everything */
        while(j) {
          ungetc(buf[j], parser->file);
          j--;
        }
loop is calling ungetc first with an uninitialized byte (j is one above the
last index stored).  There are various other issues in the program.



More information about the Gcc-bugs mailing list