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

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #3)
> A workaround might be to pad pp's buffer with trailing zero bytes up to a
> multiple of 16.

The following hack "fixes" it (for some definition of "fix"):

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 5700ccccc493..4858fec0dc3e 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -1843,6 +1843,11 @@ private:
     pretty_printer pp;
     pp_string (&pp, (const char *) tok.val.str.text);
     pp_newline (&pp);
+
+    // FIXME: workaround for PR 112965
+    for (int i = 0; i < 16; i++)
+      pp_character (&pp, '\0');
+
     cpp_push_buffer (parse_in,
                     (const unsigned char *) pp_formatted_text (&pp),
                     strlen (pp_formatted_text (&pp)),

Reply via email to