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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhy...@gcc.gnu.org>:

https://gcc.gnu.org/g:336ce497fb266268a79544f00dd3bbd24cf3a4d6

commit r13-6631-g336ce497fb266268a79544f00dd3bbd24cf3a4d6
Author: Lewis Hyatt <lhy...@gmail.com>
Date:   Sat Jan 14 13:29:22 2023 -0500

    libcpp: Fix ICE on directive inside _Pragma() operator [PR67046]

    get__Pragma_string() in directives.cc is responsible for lexing the parens
    and the string argument from a _Pragma("...") operator. This function does
    not handle the case when the closing paren is not on the same line as the
    string; in that case, libcpp will by default reuse the token buffer it
    previously used for the string, so that the string token returned by
    get__Pragma_string() may be corrupted, as shown in the testcase. Fix using
    the existing keep_tokens mechanism that temporarily disables the reuse of
    token buffers.

    libcpp/ChangeLog:

            PR preprocessor/67046
            * directives.cc (_cpp_do__Pragma): Increment pfile->keep_tokens to
            ensure the returned string token is valid.

    gcc/testsuite/ChangeLog:

            PR preprocessor/67046
            * c-c++-common/cpp/pr67046.c: New test.
  • [Bug preprocessor/67046] [10/11... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to