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 #10 from wilson at gcc dot gnu dot org  2005-11-01 07:19 -------
On mainline, this appears to be fixable with a one line patch.

We are failing in should_stack_file because we have a _cpp_file struct with
buffer=0 and buffer_valid=1.  We call read_file which immediately returns
because buffer_valid is true.  Then we try to read chars from the buffer and
crash because it is still zero.

The trivial fix is that we must clear buffer_valid when we clear buffer.  This
is done in _cpp_pop_file_buffer.  The testcase works with this patch.

I haven't looked at any of the patch history or at the older gcc versions yet.


-- 


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]