public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/103415] [12 Regression] ICE in cpp_interpret_string_1, at libcpp/charset.c:1739
Date: Wed, 01 Dec 2021 09:10:11 +0000	[thread overview]
Message-ID: <bug-103415-4-1BJsC0XXPt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103415-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:ac5fd364f0978c62ae759e7b36ce6b912a27546c

commit r12-5651-gac5fd364f0978c62ae759e7b36ce6b912a27546c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Dec 1 10:07:59 2021 +0100

    libcpp: Fix up #__VA_OPT__ handling [PR103415]

    stringify_arg uses pfile->u_buff to create the string literal.
    Unfortunately, paste_tokens -> _cpp_lex_direct -> lex_number ->
_cpp_unaligned_alloc
    can in some cases use pfile->u_buff too, which results in losing everything
    prepared for the string literal until the token pasting.

    The following patch fixes that by not calling paste_token during the
    construction of the string literal, but doing that before.  All the tokens
    we are processing have been pushed into a token buffer using
    tokens_buff_add_token so it is fine if we paste some of them in that buffer
    (successful pasting creates a new token in that buffer), move following
    tokens if any to make it contiguous, pop (throw away) the extra tokens at
    the end and then do stringify_arg.

    Also, paste_tokens now copies over PREV_WHITE and PREV_FALLTHROUGH flags
    from the original lhs token to the replacement token.  Copying that way
    the PREV_WHITE flag is needed for the #__VA_OPT__ handling and copying
    over PREV_FALLTHROUGH fixes the new Wimplicit-fallthrough-38.c test.

    2021-12-01  Jakub Jelinek  <jakub@redhat.com>

            PR preprocessor/103415
    libcpp/
            * macro.c (stringify_arg): Remove va_opt argument and va_opt
handling.
            (paste_tokens): On successful paste or in PREV_WHITE and
            PREV_FALLTHROUGH flags from the *plhs token to the new token.
            (replace_args): Adjust stringify_arg callers.  For #__VA_OPT__,
            perform token pasting in a separate loop before stringify_arg call.
    gcc/testsuite/
            * c-c++-common/cpp/va-opt-8.c: New test.
            * c-c++-common/Wimplicit-fallthrough-38.c: New test.

  parent reply	other threads:[~2021-12-01  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24 17:48 [Bug c/103415] New: " gscfq@t-online.de
2021-11-24 17:49 ` [Bug c/103415] " gscfq@t-online.de
2021-11-24 17:51 ` [Bug preprocessor/103415] " pinskia at gcc dot gnu.org
2021-11-25  0:33 ` pinskia at gcc dot gnu.org
2021-11-25  9:58 ` marxin at gcc dot gnu.org
2021-11-25 15:25 ` jakub at gcc dot gnu.org
2021-11-25 17:11 ` jakub at gcc dot gnu.org
2021-12-01  9:10 ` cvs-commit at gcc dot gnu.org [this message]
2021-12-01  9:16 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103415-4-1BJsC0XXPt@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).