https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102409

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I wonder whether the following causes that it goes wrong (libcpp/macro.c):

/* Push the context of a macro with hash entry NODE onto the context
   stack.  If we can successfully expand the macro, we push a context
   containing its yet-to-be-rescanned replacement list and return one.
   If there were additionally any unexpanded deferred #pragma
   directives among macro arguments, push another context containing
   the pragma tokens before the yet-to-be-rescanned replacement list
   and return two.  Otherwise, we don't push a context and return
   zero. LOCATION is the location of the expansion point of the
   macro.  */
static int
enter_macro_context (cpp_reader *pfile, cpp_hashnode *node,

  * * *

If I do the following change, it works for the small/large testcase:

--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -1262 +1262 @@ collect_args (cpp_reader *pfile, const cpp_hashnode *node,
-         else if (token->type == CPP_PRAGMA)
+         else if (false)



But that gives an ICE for gcc.dg/cpp/pr34692.c.


I note that both here and for the old cpp testcase,
pfile->state.prevent_expansion = 1 and parsing_args = 2.

Thus, the question is how to determine when to expand it and when not.

Reply via email to