diff options
author | Dodji Seketeli <dodji@redhat.com> | 2012-05-02 16:55:19 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2012-05-02 18:55:19 +0200 |
commit | 3ad64f53daf2522a94bf42c7378e7ea7b799f7c6 (patch) | |
tree | eca8487b03f6e48b0470d9df650fe3ac37959625 /libcpp/macro.c | |
parent | 355a76735231beec33c140af2d9e6adca486225c (diff) | |
download | gcc-3ad64f53daf2522a94bf42c7378e7ea7b799f7c6.zip gcc-3ad64f53daf2522a94bf42c7378e7ea7b799f7c6.tar.gz gcc-3ad64f53daf2522a94bf42c7378e7ea7b799f7c6.tar.bz2 |
Properly initialize cpp_context in destringize_and_run
destringize_and_run forgets to initialize all the fields of the
cpp_context that it pushes. Later _cpp_pop_context then gets confused
when it accesses context->tokens_kind via the call to macro_of_context
on context->prev.
The first hunk of this patch is the real obvious fix. The second hunk
is just an assert that I am adding to err on the safe side.
Tested by on x86_64-unknown-linux-gnu against trunk by running the
test gcc.dg/gomp/macro-4.c under Valgrind, and bootstrapped.
libcpp/
* directives.c (destringize_and_run): Properly initialize the new
context.
* macro.c (_cpp_pop_context): Assert that we shouldn't try to pop
the initial base context, which has the same life time as the
current instance of cpp_file.
From-SVN: r187054
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index ab3e8f6..c4e2a23 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -2152,6 +2152,10 @@ _cpp_pop_context (cpp_reader *pfile) { cpp_context *context = pfile->context; + /* We should not be popping the base context. */ + if (context == &pfile->base_context) + abort (); + if (context->c.macro) { cpp_hashnode *macro; |