This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR c++/26660: gomp regression to C++ PCH machinery
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 May 2006 03:50:57 -0300
- Subject: PR c++/26660: gomp regression to C++ PCH machinery
We can't lex the token past the PCH pragma before doing the PCH magic,
otherwise the lexed token will point to GC memory that is invalidated
by the PCH magic.
Bootstrapped and regtested on adm64-linux-gnu. Ok to install?
for gcc/cp/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR c++/26660
* parser.c (cp_parser_initial_pragma): Read one more token for
caller after reading PCH file in.
Index: gcc/cp/parser.c
===================================================================
--- gcc/cp/parser.c.orig 2006-05-29 00:03:42.000000000 -0300
+++ gcc/cp/parser.c 2006-05-29 00:03:56.000000000 -0300
@@ -18998,12 +18998,14 @@ cp_parser_initial_pragma (cp_token *firs
while (first_token->type != CPP_PRAGMA_EOL && first_token->type != CPP_EOF)
cp_lexer_get_preprocessor_token (NULL, first_token);
- /* Read one more token to return to our caller. */
- cp_lexer_get_preprocessor_token (NULL, first_token);
-
/* Now actually load the PCH file. */
if (name)
c_common_pch_pragma (parse_in, TREE_STRING_POINTER (name));
+
+ /* Read one more token to return to our caller. We have to do this
+ after reading the PCH file in, since its pointers have to be
+ live. */
+ cp_lexer_get_preprocessor_token (NULL, first_token);
}
/* Normal parsing of a pragma token. Here we can (and must) use the
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}