This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/24202] [3.4/4.0/4.1 Regression] Segfault with #pragma once



------- Comment #13 from wilson at gcc dot gnu dot org  2005-11-01 23:51 -------
I believe the problem originated here:
2003-07-29  Neil Booth  <neil@daikokuya.co.uk>

        PR preprocessor/11569
        PR preprocessor/11649
        * Makefile.in (LIBCPP_DEPS): Add HASHTAB_H.
        * cppfiles.c: Completely rewritten.
        ...

This added the buffer_valid field, and added code that clears buffer without
also clearing buffer_valid.  This is revision 1.178 in the gcc/cppfiles.c file.

The failure occurs only when we free a valid buffer, and then try to reuse that
buffer because we still think it is valid.  Whether this occurs depends on how
buffers are managed by cpp, and how they are used by cpp, so I don't find it
surprising that this latent bug has been disappearing and reappearing over
time.  The patch identified by Janis just makes the problem more visible
because it adds more uses of buffer_valid.

Now I'm off to test my patch.  The same patch should work for all 3 gcc
versions.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]