On Tue, Feb 01, 2022 at 12:28:57AM +0100, Jakub Jelinek via Gcc-patches wrote:
> I haven't, but will do so now.

So, I've done another bootstrap/regtest with incremental
--- gcc/c-family/c-lex.cc.jj    2022-01-18 00:18:02.558747051 +0100
+++ gcc/c-family/c-lex.cc       2022-02-01 00:39:47.314183266 +0100
@@ -297,6 +297,7 @@ get_token_no_padding (cpp_reader *pfile)
       ret = cpp_get_token (pfile);
       if (ret->type != CPP_PADDING)
        return ret;
+      gcc_assert ((ret->flags & PREV_WHITE) == 0);
     }
 }
 
@@ -487,6 +488,7 @@ c_lex_with_flags (tree *value, location_
   switch (type)
     {
     case CPP_PADDING:
+      gcc_assert ((tok->flags & PREV_WHITE) == 0);
       goto retry;
 
     case CPP_NAME:
@@ -1267,6 +1269,7 @@ lex_string (const cpp_token *tok, tree *
   switch (tok->type)
     {
     case CPP_PADDING:
+      gcc_assert ((tok->flags & PREV_WHITE) == 0);
       goto retry;
     case CPP_ATSIGN:
       if (objc_string)
--- libcpp/macro.cc.jj  2022-01-31 22:11:34.000000000 +0100
+++ libcpp/macro.cc     2022-02-01 00:28:30.717339868 +0100
@@ -1373,6 +1373,7 @@ funlike_invocation_p (cpp_reader *pfile,
       token = cpp_get_token (pfile);
       if (token->type != CPP_PADDING)
        break;
+      gcc_assert ((token->flags & PREV_WHITE) == 0);
       if (padding == NULL
          || padding->val.source == NULL
          || (!(padding->val.source->flags & PREV_WHITE)

patch.  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++)
    ;
}
I wonder if we shouldn't replace that
      toks[0] = pfile->directive_result;
line with
      toks[0] = pfile->avoid_paste;
or even replace those
      toks = XNEW (cpp_token);
      toks[0] = pfile->directive_result;
lines with
      toks = &pfile->avoid_paste;
(dunno how about the memory management whether something frees
the tokens or not, but e.g. funlike_invocation_p certainly uses the same
_cpp_push_token_context and pushes through that quite often
&pfile->avoid_paste).

+FAIL: 20_util/specialized_algorithms/pstl/uninitialized_construct.cc (test for 
excess errors)
+FAIL: 20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc (test for 
excess errors)
+FAIL: 20_util/specialized_algorithms/pstl/uninitialized_fill_destroy.cc (test 
for excess errors)
+FAIL: 25_algorithms/pstl/alg_merge/inplace_merge.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_merge/merge.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/copy_if.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/copy_move.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/fill.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/generate.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/is_partitioned.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/partition.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/partition_copy.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/remove.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/remove_copy.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/replace.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/replace_copy.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/rotate.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/rotate_copy.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/swap_ranges.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/transform_binary.cc (test 
for excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/transform_unary.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/unique.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_modifying_operations/unique_copy_equal.cc (test 
for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/adjacent_find.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/all_of.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/any_of.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/count.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/equal.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/find.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/find_end.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/find_first_of.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/find_if.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/for_each.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/mismatch.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/none_of.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/nth_element.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/reverse.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/reverse_copy.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_nonmodifying/search_n.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/includes.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/is_heap.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/is_sorted.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/lexicographical_compare.cc (test for 
excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/minmax_element.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/partial_sort.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/partial_sort_copy.cc (test for excess 
errors)
+FAIL: 25_algorithms/pstl/alg_sorting/set.cc (test for excess errors)
+FAIL: 25_algorithms/pstl/alg_sorting/sort.cc (test for excess errors)
+FAIL: 26_numerics/pstl/numeric_ops/adjacent_difference.cc (test for excess 
errors)
+FAIL: 26_numerics/pstl/numeric_ops/reduce.cc (test for excess errors)
+FAIL: 26_numerics/pstl/numeric_ops/scan.cc (test for excess errors)
+FAIL: 26_numerics/pstl/numeric_ops/transform_reduce.cc (test for excess errors)
+FAIL: 26_numerics/pstl/numeric_ops/transform_scan.cc (test for excess errors)
(+ corresponding UNRESOLVED).

        Jakub

Reply via email to