gcc/libcpp
Jakub Jelinek efc46b550f libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens
The funlike_invocation_p macro never triggered, the other
asserts did on some tests, see below for a full list.
This seems to be caused by #pragma/_Pragma handling.
do_pragma does:
          pfile->directive_result.src_loc = pragma_token_virt_loc;
          pfile->directive_result.type = CPP_PRAGMA;
          pfile->directive_result.flags = pragma_token->flags;
          pfile->directive_result.val.pragma = p->u.ident;
when it sees a pragma, while start_directive does:
  pfile->directive_result.type = CPP_PADDING;
and so does _cpp_do__Pragma.
Now, for #pragma lex.cc will just ignore directive_result if
it has CPP_PADDING type:
              if (_cpp_handle_directive (pfile, result->flags & PREV_WHITE))
                {
                  if (pfile->directive_result.type == CPP_PADDING)
                    continue;
                  result = &pfile->directive_result;
                }
but destringize_and_run does not:
  if (pfile->directive_result.type == CPP_PRAGMA)
    {
...
    }
  else
    {
      count = 1;
      toks = XNEW (cpp_token);
      toks[0] = pfile->directive_result;
and from there it will copy type member of CPP_PADDING, but all the
other members from the last CPP_PRAGMA before it.
Small testcase for it with no option (at least no -fopenmp or -fopenmp-simd).
 #pragma GCC push_options
 #pragma GCC ignored "-Wformat"
 #pragma GCC pop_options
void
foo ()
{
  _Pragma ("omp simd")
  for (int i = 0; i < 64; i++)
    ;
}

Here is a patch that replaces those
      toks = XNEW (cpp_token);
      toks[0] = pfile->directive_result;
lines with
      toks = &pfile->avoid_paste;

2022-02-01  Jakub Jelinek  <jakub@redhat.com>

	* directives.cc (destringize_and_run): Push &pfile->avoid_paste
	instead of a copy of pfile->directive_result for the CPP_PADDING
	case.
2022-02-01 20:42:49 +01:00
..
include preprocessor: -Wbidi-chars and UCNs [PR104030] 2022-01-24 17:48:23 -05:00
po Daily bump. 2021-12-21 00:16:24 +00:00
aclocal.m4 libcpp: Enable Intel CET on Intel CET enabled host for jit 2020-05-12 09:17:45 -07:00
ChangeLog Daily bump. 2022-01-25 00:16:27 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
charset.cc Change references of .c files to .cc files 2022-01-17 22:12:07 +01:00
config.in aix: handle 64bit inodes for include directories 2022-01-12 16:59:47 +01:00
configure aix: handle 64bit inodes for include directories 2022-01-12 16:59:47 +01:00
configure.ac aix: handle 64bit inodes for include directories 2022-01-12 16:59:47 +01:00
directives.cc libcpp: Avoid PREV_WHITE and other random content on CPP_PADDING tokens 2022-02-01 20:42:49 +01:00
errors.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
expr.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
files.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
generated_cpp_wcwidth.h libcpp: Update cpp_wcwidth() to Unicode 13.0.0 2020-11-07 09:36:43 -05:00
identifiers.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
init.cc Change references of .c files to .cc files 2022-01-17 22:12:07 +01:00
internal.h preprocessor: -Wbidi-chars and UCNs [PR104030] 2022-01-24 17:48:23 -05:00
lex.cc preprocessor: -Wbidi-chars and UCNs [PR104030] 2022-01-24 17:48:23 -05:00
line-map.cc pack fields in line-map data structures 2022-01-18 14:33:01 +01:00
location-example.txt PR preprocessor/83173: Enhance -fdump-internal-locations output 2018-11-27 16:04:31 +00:00
macro.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
Makefile.in Manual changes for .cc renaming. 2022-01-17 22:12:14 +01:00
makeucnid.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
mkdeps.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
pch.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
symtab.cc Rename .c files to .cc files. 2022-01-17 22:12:04 +01:00
system.h Update copyright years. 2022-01-03 10:42:10 +01:00
traditional.cc Change references of .c files to .cc files 2022-01-17 22:12:07 +01:00
ucnid.h Update copyright years. 2022-01-03 10:42:10 +01:00
ucnid.tab Update copyright years. 2022-01-03 10:42:10 +01:00