This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/24202] [3.4/4.0/4.1 Regression] Segfault with #pragma once
- From: "wilson at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Nov 2005 07:19:27 -0000
- Subject: [Bug preprocessor/24202] [3.4/4.0/4.1 Regression] Segfault with #pragma once
- References: <bug-24202-5724@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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