From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id AD15D3858D1E for ; Sat, 11 Mar 2023 17:21:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD15D3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1030.google.com with SMTP id u3-20020a17090a450300b00239db6d7d47so7941557pjg.4 for ; Sat, 11 Mar 2023 09:21:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678555271; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vv1Xp7uZ1Gp8lGJYmd5VV+UGHjEOpZP+vYvyf+64CZY=; b=kl6igk7z4XdWlIfBXtOgon9zkokcJ7cntwEcyrDEX2LkT0VOw5JXihUKagpJhWBmsl D1/RKgZNgf9OI7Ocnb0Z/sjPMwOYeBj9RTQFSbKefNWp1uFUgm6fOqM2GhpNNTxgqBgQ Gn803943Nj8KlKd99/VTOs6GNlSdG8p77UK5oTentRcif5Hf4hOmElnCudfQ1+5URi5u OB0Z1b19MJt19CfOXfemrAgXl48wLSobt6cs2KMXiY89txaE5JApabShnuGqemOHKjRe fg+Rl5dEdFklkfKu037TCpzfHYH7GmSwiQ+H1vPC9+hT/ErsY9uIcoErUX/PsLEJcW2O GmQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678555271; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vv1Xp7uZ1Gp8lGJYmd5VV+UGHjEOpZP+vYvyf+64CZY=; b=bFe294kz/FPAD7lVnmEpOUOKOacrHl6ud/Q+q+u39kgwMXzxEdw9H4kXwsQl6t0rmx p/Z45dDaFvrwj13iulTa8x3QC/Sn9u05vYVbobI+snLCKFqYlf8CvZiF2G/8LKI2JZqi x23bmJhMfFzsLn+2KWkWKdHX11P8Be4e+iipOCnwbcahp3iqzLS9AfcxZc/9UCR2G78D 03zTlKdV8o2vK3zv+CPzvwl654CTDezKj4ghAw/4jYpOnnx6UJ3CVdRyfFRHIGezldD9 UYQq7Yv9P3MMoZefIxDAu7/TZqvvAMKYUV2YhzhJoevrM6MpOGYFsAc+fYyBIQuW3zCQ AzCw== X-Gm-Message-State: AO0yUKW2/V6+0guUm4+bDp/hRlddkO1i1CsMNE2DVf1TVOTiQ8Txuzl+ iPCDC34P2tj12RNTz402q3o= X-Google-Smtp-Source: AK7set9fkHDyn7+OzE3646HBDG3NhrOz1FTklcTvun6b0DSS30Siw+hdNsJ0WmOlv7X4Mrl82AM5gg== X-Received: by 2002:a17:903:22c5:b0:198:fded:3b69 with SMTP id y5-20020a17090322c500b00198fded3b69mr36352982plg.53.1678555271620; Sat, 11 Mar 2023 09:21:11 -0800 (PST) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id kn6-20020a170903078600b0019c2d664869sm1756936plb.298.2023.03.11.09.21.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Mar 2023 09:21:11 -0800 (PST) Message-ID: <44f0b594-0e67-0c04-54c1-5b4a72425282@gmail.com> Date: Sat, 11 Mar 2023 10:21:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] libcpp: Fix ICE on directive inside _Pragma() operator [PR67046] Content-Language: en-US To: Lewis Hyatt , gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/14/23 11:46, Lewis Hyatt via Gcc-patches wrote: > 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. OK for the trunk. Sorry for the long wait. jeff