summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-18 00:58:58 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-18 00:58:58 +0000
commit6e6d82ef6a6f08f29838b6ba3817eb53bbe33be3 (patch)
tree5c35a8e5b6fb34788c3fd69310012a174a5fcceb
parentae154785db19f600d5f2023c8f398cf115c4be9a (diff)
downloadppe42-gcc-6e6d82ef6a6f08f29838b6ba3817eb53bbe33be3.tar.gz
ppe42-gcc-6e6d82ef6a6f08f29838b6ba3817eb53bbe33be3.zip
PR libcpp/34866:
* errors.c (cpp_error): Don't reference a token before the start of the current run. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134421 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/errors.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 0eb632f92f9..0826b628a9b 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-17 Tom Tromey <tromey@redhat.com>
+
+ PR libcpp/34866:
+ * errors.c (cpp_error): Don't reference a token before the start
+ of the current run.
+
2008-04-16 Tom Tromey <tromey@redhat.com>
* Makefile.in (TAGS_SOURCES): New variable.
diff --git a/libcpp/errors.c b/libcpp/errors.c
index 97de4900001..0b7c1e0f458 100644
--- a/libcpp/errors.c
+++ b/libcpp/errors.c
@@ -1,6 +1,6 @@
/* Default error handlers for CPP Library.
Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
- 2001, 2002, 2004 Free Software Foundation, Inc.
+ 2001, 2002, 2004, 2008 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -151,6 +151,15 @@ cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
else
src_loc = pfile->line_table->highest_line;
}
+ /* We don't want to refer to a token before the beginning of the
+ current run -- that is invalid. */
+ else if (pfile->cur_token == pfile->cur_run->base)
+ {
+ if (pfile->cur_run->prev != NULL)
+ src_loc = pfile->cur_run->prev->limit->src_loc;
+ else
+ src_loc = 0;
+ }
else
{
src_loc = pfile->cur_token[-1].src_loc;
OpenPOWER on IntegriCloud