This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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  <>

	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
Secretary for FSF Latin America
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]