From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by sourceware.org (Postfix) with ESMTPS id E94D23858D1E for ; Fri, 17 Nov 2023 14:16:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E94D23858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E94D23858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700230580; cv=none; b=TVohzq76QMHpMqSOYUOHD4hMSZKvzcyaW1wyyuGOZW5y1LNZFZhO5gS/++lujMRSJ8aLZloE/7BCLIjXYb4GJgodvnCS0E+a4eHMaeX4ZCfxuo9p9JlOX/I+vz1bL6V0HJZ8DCXd/svwPmep2loxa1gs9GIkgFGn+4VcdbQUzOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700230580; c=relaxed/simple; bh=qrGfW4Sk5T9zwy9KO1phgJc5Q0N7lm66sy0QQCybUTE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=P4rvXfbAVmoCqLdlLexkA16aSXKJw6KGUy++/NTt4fu+a7I28JKJma3JF9sw9S6Jx2eqfKFlvngTDlKfXABOKpyRpAEFBPSXDA1uxcbf1tHnvm5TejKIH3QUhDNBCDIzKXDp0c0dF/jv8scINtuW65uWuBJd4djah8r76tzColI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5a92782615dso22817597b3.2 for ; Fri, 17 Nov 2023 06:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700230578; x=1700835378; darn=gcc.gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8vFpowyUcrNZjvKNDsDNq7EqGSsGHCYVn4IyXhg3nkI=; b=mgtU7XGsthYfpzI2tK1ApHz8HJhW0hvYu4mKkG2/hHOPqWkGo1ZLsUMMFa+NSXgZi9 3jKPH6p/2B9f3EJ7cjAt/arHmtfpsqus07fjpPfDJFTcw7nPUyYP1NaxZqqh5OEdgJd4 BGGzQOEezW9Cowf7yb5n+NgI8aPvCiTyu47IP1DIkbMgyw5m4a+qBbXU60pnTgXlAUqM Jw6oCMjWOSnn8c5u213ZcnOCAtnw1ZajceJc/9KfQzeTJqQE3Qllt7QIDEzlcnFm2wLH bTFMtrlSrU6nTOtpVQ04hMP3RKGyXv3FE6ITGVJw/n7naAMSaTe+Kh4yLWwczww+uCwX +D0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700230578; x=1700835378; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8vFpowyUcrNZjvKNDsDNq7EqGSsGHCYVn4IyXhg3nkI=; b=Z6OwXZ7VxruV0+z+2AUys+a8Ve0BiMWPgJR+kTRyETMOMD7AgWIRgXVftH2iVH6Qo4 LwM5fwab9rAOhIs7/+9b7VaNggB0EZY+MhaPkE89qKHQFUwI4d5sji5+u49czbUJFP2n k1y4TvviMh1N40PxBIMNPxIW2vbgETHftXVhhzcsFJ8V7UcMfWpgqLEkbfvLmqeN6riU +pQ4jxjvb6/RTsBdKmThv1Dz28yvI84Tg4OzLltJL+1bVyv+hNokgzeSfSca+zXfCyT8 piuxuI7+Qb9qp3UNyXKwdVwEAQQute8Cn1Y2olI5C6nETLMumqY/QGeV8aw1CQSa0Paa fZkg== X-Gm-Message-State: AOJu0YxHjqv395KTfaNbxA6NM2vGyrprvuNbgBDKjfca9CAvZE/x866n 61gl0R51jGROzUMWl+dERS5KaE7T1kJPnUTsGb/V9Erc+HE= X-Google-Smtp-Source: AGHT+IH/C+N7csLJfwATJqA0pLTT2nEkmyWV+0s1zAFTVVOOmIWjMLhDSHWnUAu8ykvA1krFL+0neO4h3MPHwwberPk= X-Received: by 2002:a0d:f701:0:b0:5c8:c9af:3e01 with SMTP id h1-20020a0df701000000b005c8c9af3e01mr284918ywf.42.1700230578290; Fri, 17 Nov 2023 06:16:18 -0800 (PST) MIME-Version: 1.0 References: <20231101215457.3935908-1-lhyatt@gmail.com> In-Reply-To: <20231101215457.3935908-1-lhyatt@gmail.com> From: Lewis Hyatt Date: Fri, 17 Nov 2023 09:16:06 -0500 Message-ID: Subject: ping: [PATCH] preprocessor: Reinitialize frontend parser after loading a PCH [PR112319] To: gcc-patches List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3035.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: May I please ping this one? Thanks... https://gcc.gnu.org/pipermail/gcc-patches/2023-November/634931.html On Wed, Nov 1, 2023 at 5:55=E2=80=AFPM Lewis Hyatt wrote= : > > Hello- > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112319 > > This is a one-line patch to fix the GCC 14 regression noted in the > PR. Bootstrap + regtest all languages on x86-64 looks good. Is it OK plea= se? > Thanks! > > -Lewis > > -- >8 -- > > Since r14-2893, the frontend parser object needs to exist when running in > preprocess-only mode, because pragma_lex() is now called in that mode and > needs to make use of it. This is handled by calling c_init_preprocess() a= t > startup. If -fpch-preprocess is in effect (commonly, because of > -save-temps), a PCH file may be loaded during preprocessing, in which > case the parser will be destroyed, causing the issue noted in the > PR. Resolve it by reinitializing the frontend parser after loading the PC= H. > > gcc/c-family/ChangeLog: > > PR pch/112319 > * c-ppoutput.cc (cb_read_pch): Reinitialize the frontend parser > after loading a PCH. > > gcc/testsuite/ChangeLog: > > PR pch/112319 > * g++.dg/pch/pr112319.C: New test. > * g++.dg/pch/pr112319.Hs: New test. > * gcc.dg/pch/pr112319.c: New test. > * gcc.dg/pch/pr112319.hs: New test. > --- > gcc/c-family/c-ppoutput.cc | 5 +++++ > gcc/testsuite/g++.dg/pch/pr112319.C | 5 +++++ > gcc/testsuite/g++.dg/pch/pr112319.Hs | 1 + > gcc/testsuite/gcc.dg/pch/pr112319.c | 5 +++++ > gcc/testsuite/gcc.dg/pch/pr112319.hs | 1 + > 5 files changed, 17 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/pch/pr112319.C > create mode 100644 gcc/testsuite/g++.dg/pch/pr112319.Hs > create mode 100644 gcc/testsuite/gcc.dg/pch/pr112319.c > create mode 100644 gcc/testsuite/gcc.dg/pch/pr112319.hs > > diff --git a/gcc/c-family/c-ppoutput.cc b/gcc/c-family/c-ppoutput.cc > index 4aa2bef2c0f..4f973767976 100644 > --- a/gcc/c-family/c-ppoutput.cc > +++ b/gcc/c-family/c-ppoutput.cc > @@ -862,4 +862,9 @@ cb_read_pch (cpp_reader *pfile, const char *name, > > fprintf (print.outf, "#pragma GCC pch_preprocess \"%s\"\n", name); > print.src_line++; > + > + /* The process of reading the PCH has destroyed the frontend parser, > + so ask the frontend to reinitialize it, in case we need it to > + process any #pragma directives encountered while preprocessing. */ > + c_init_preprocess (); > } > diff --git a/gcc/testsuite/g++.dg/pch/pr112319.C b/gcc/testsuite/g++.dg/p= ch/pr112319.C > new file mode 100644 > index 00000000000..9e0457e8aec > --- /dev/null > +++ b/gcc/testsuite/g++.dg/pch/pr112319.C > @@ -0,0 +1,5 @@ > +/* { dg-additional-options "-Wpragmas -save-temps" } */ > +#include "pr112319.H" > +#pragma GCC diagnostic error "-Wpragmas" > +#pragma GCC diagnostic ignored "oops" /* { dg-error "oops" } */ > +/* { dg-regexp {[^[:space:]]*: some warnings being treated as errors} } = */ > diff --git a/gcc/testsuite/g++.dg/pch/pr112319.Hs b/gcc/testsuite/g++.dg/= pch/pr112319.Hs > new file mode 100644 > index 00000000000..3b6178bfae0 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/pch/pr112319.Hs > @@ -0,0 +1 @@ > +/* This space intentionally left blank. */ > diff --git a/gcc/testsuite/gcc.dg/pch/pr112319.c b/gcc/testsuite/gcc.dg/p= ch/pr112319.c > new file mode 100644 > index 00000000000..043881463c5 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pch/pr112319.c > @@ -0,0 +1,5 @@ > +/* { dg-additional-options "-Wpragmas -save-temps" } */ > +#include "pr112319.h" > +#pragma GCC diagnostic error "-Wpragmas" > +#pragma GCC diagnostic ignored "oops" /* { dg-error "oops" } */ > +/* { dg-regexp {[^[:space:]]*: some warnings being treated as errors} } = */ > diff --git a/gcc/testsuite/gcc.dg/pch/pr112319.hs b/gcc/testsuite/gcc.dg/= pch/pr112319.hs > new file mode 100644 > index 00000000000..3b6178bfae0 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pch/pr112319.hs > @@ -0,0 +1 @@ > +/* This space intentionally left blank. */