From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11725 invoked by alias); 1 Nov 2005 07:19:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11707 invoked by uid 48); 1 Nov 2005 07:19:27 -0000 Date: Tue, 01 Nov 2005 07:19:00 -0000 Message-ID: <20051101071927.11706.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug preprocessor/24202] [3.4/4.0/4.1 Regression] Segfault with #pragma once In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "wilson at gcc dot gnu dot org" X-SW-Source: 2005-11/txt/msg00036.txt.bz2 List-Id: ------- 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