aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2005-02-28 11:04:19 -0800
committerDevang Patel <dpatel@gcc.gnu.org>2005-02-28 11:04:19 -0800
commit2203a881041c8ecd559282229f6bc8cd019c4697 (patch)
tree0ba8e36d9933835b4bc05df76dc4cbc716b85880
parent321cf1f25e3accb866f1a93097677dee6bb05f49 (diff)
downloadgcc-2203a881041c8ecd559282229f6bc8cd019c4697.zip
gcc-2203a881041c8ecd559282229f6bc8cd019c4697.tar.gz
gcc-2203a881041c8ecd559282229f6bc8cd019c4697.tar.bz2
directives.c (do_line): Save sysp early before line table is realloc'ed.
* directives.c (do_line): Save sysp early before line table is realloc'ed. From-SVN: r95691
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/directives.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 5e6ad28..1f441b1 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-28 Devang Patel <dpatel@apple.com>
+
+ * directives.c (do_line): Save sysp early before line table is
+ realloc'ed.
+
2005-02-20 Zack Weinberg <zack@codesourcery.com>
PR 18785
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 8a6d45a..8406505 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -775,6 +775,11 @@ do_line (cpp_reader *pfile)
{
const struct line_maps *line_table = pfile->line_table;
const struct line_map *map = &line_table->maps[line_table->used - 1];
+
+ /* skip_rest_of_line() may cause line table to be realloc()ed so note down
+ sysp right now. */
+
+ unsigned char map_sysp = map->sysp;
const cpp_token *token;
const char *new_file = map->to_file;
unsigned long new_lineno;
@@ -815,7 +820,7 @@ do_line (cpp_reader *pfile)
skip_rest_of_line (pfile);
_cpp_do_file_change (pfile, LC_RENAME, new_file, new_lineno,
- map->sysp);
+ map_sysp);
}
/* Interpret the # 44 "file" [flags] notation, which has slightly