This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: PR c++/26660: gomp regression to C++ PCH machinery


Alexandre Oliva <aoliva@redhat.com> writes:

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

This is OK, assuming you did check that #pragma GCC pch_preprocess
continues to work...

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


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