Message ID | 65b56cce.170a0220.25f58.78f9@mx.google.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2395:b0:106:343:edcb with SMTP id gw21csp668896dyb; Sat, 27 Jan 2024 12:52:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMwGuWxv3J3ctXSfgSk0cFMICCkGfWj/K72Gon4z5WVqnclH2NVGtXNx4UYZwR9ExsPgyw X-Received: by 2002:a05:622a:105:b0:429:da16:fb60 with SMTP id u5-20020a05622a010500b00429da16fb60mr2550964qtw.111.1706388726080; Sat, 27 Jan 2024 12:52:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706388726; cv=pass; d=google.com; s=arc-20160816; b=DdOfiXu9MagUesEL1jemgSPI0DmOYezZLoN8HhUz1m+dB0ixpqDT6rtGrhDTShfJdz LRJ0CWNrD+lh9Jr/P1cW22ia6eKkVpMYhbT2Ee5xldM6+I7uDKKVhBc9OID8s3AUw2kc HTvF0cnEMkA44/L7aP92T0ohalIrfigYPKXif8TSwBnECT9ZJiW37c4glu9cssF+xK7S MZdTkDG91bMS4irVdUS+DTmTaDvO2lyq5avmX8OAUzFIKrrg/AKPqaT456rC/ksB27D4 bTOTnYADV/rsKawGLts45DgaGQWPxo7fP/zp8cjxwKnWbM1SEr0B4YdyPjVpy9Gbs51P DcqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:subject:cc:to:from:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=iSBwUi5PzeMWsVCKTstlwQAgues176c79osCcJo8VKE=; fh=VXKQqVAN44uYMGSG7LgkmvSv95b5Mnby24icgxW9ueQ=; b=MH4QRpy/gWSCmsWFqnTdmTf4oqZSV52QFWvPKBLem8VyNAfGE+uJ7/HHsYy1bkp88q 87E94DpqXeQ5D+Zk6kMlEU+1S3eqOqOZHef+Lt3sZ/56KcWpSqGEL6tR8fAzsZkMbS4P NzrlRvVDMnI0JO8fsF/oise1s6jQ+JeZO4oleXYFnaTXmryLLqaNy+D5srAb46BX+SYP xwp1sTg+E0svHr6jOoeVkpNUj5PkFDR+JVtatF/vH1CR70jM+2e0Zs8KFGFzRcjnzKM0 gKAhrF2FO6SLilG894Gm/498UwyRC6YJKlkD31zfC6VyC1Cw3S3ET6Ny9GcRlikqOkMk 2DHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eNq6F3jq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s17-20020a05622a179100b0042a59926617si4213572qtk.711.2024.01.27.12.52.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 12:52:06 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eNq6F3jq; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8CA13858417 for <ouuuleilei@gmail.com>; Sat, 27 Jan 2024 20:52:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id E88163858C60 for <gcc-patches@gcc.gnu.org>; Sat, 27 Jan 2024 20:51:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E88163858C60 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 E88163858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706388689; cv=none; b=IdyPkrAJMMnBS2Uf5iu0vfDhUxiNzXB7Cz93aYypGTFN/DnZdTNYGZpJ6gjrMLXv+RUJWN04eChBFCqIZiB8KGkPDpotRk8/jyX0V9LL7KIcj08LJA+Xxtj2rN7f+psUzC1TYGepDDTDoqIyR79U3VSj/wLXX64cKK9N8IZ85jE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706388689; c=relaxed/simple; bh=R4hSSR2qRsF3st1LgRaCGL9zIeCzG6YjDjNcs4+raxo=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=BuXJ95xVNmn2hMCggBaSv1rtcPdTQftU/5ijglZgiaPOdn1aygPbRy94hSCgh12M4WAxOXTFMOssbeHoXSn6A5b3mTndbeHlyp5cIwywk4InOATfGV2IQe3ZysMPOYAPZofQPA0uxGW030KHxFYC0sIqiCnF2nf9OBOK3pYF1Vk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-290b37bb7deso1469452a91.0 for <gcc-patches@gcc.gnu.org>; Sat, 27 Jan 2024 12:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706388687; x=1706993487; darn=gcc.gnu.org; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iSBwUi5PzeMWsVCKTstlwQAgues176c79osCcJo8VKE=; b=eNq6F3jqB4hJhGSkwBCPR+78U7yBHy12l/DO7yAda7Vztc8QCdDdb3jozFugcnBb5Q gFowRopfukHSanIS9XCV+w9tckihex1uJ7xkn0UNFTy2KvXFmZ7rj/4RIOdlABgLQyST rBjGt4T+8M5KE2ybNL7WxFBg2HzohczzRWDfgt2X9UURTaLo/AJi7y48I7KYh5RSr4Rm 9Y2yYv/3DMBZfQmgQwl8DPtmFfxJOVtbNFYv1awkdC8AJl2V4e8LsTNcRc73FxdF6Roj NwVk9YjjPrQlo+4rc4afVrDd+1AQZjDJ3fRehbPXwzqrIfDvmoYYaCsv8yTS6ABIM6xF sNLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706388687; x=1706993487; h=content-disposition:mime-version:subject:cc:to:from:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iSBwUi5PzeMWsVCKTstlwQAgues176c79osCcJo8VKE=; b=SCV6HBpoZvfMKRsBCBNPzLqPtub9uPpiHVTWZj5/Mefv8NV/NcNtF8AQqg97GuXR0V WBcZgqZz4wwd3ZCiHJt+4yOlBqsAaBf9ILum8ACoAyIBNFUSvT5D1cpRAryP6EqVtsoK Xf0uZOqgdtv1XqdibuzNmsje7jfT35p67MTc7rCsh+aWYQOrCJyHc8HDG8tq1PZ83ggN VAzvX/HC4XRokrDi+eH/k5ylOWy9RHKZXrdcfuL2RagIR7kBKJzYmLyNoQGeqPLY3IHA sHtAC9o1Ax08aG2nsjqoMFwBVSk0JDXJUxrhjDFdWnHHIm3SoK+M9k4QJmVoNehqgTOp Wr5w== X-Gm-Message-State: AOJu0YxoGc00QIOLzdEzxg5VdhS3O+BM6zZi9ytLh2sEDdY0PeOp/Ben AsGHuwedtCtbTm7WwPprOHNaPCPoYk5Hk/HdYbIbyVqkpC1DN1Cd2AkZ+IXU X-Received: by 2002:a17:902:e548:b0:1d7:215a:8065 with SMTP id n8-20020a170902e54800b001d7215a8065mr2410242plf.34.1706388686776; Sat, 27 Jan 2024 12:51:26 -0800 (PST) Received: from Thaum. (123-243-206-49.tpgi.com.au. [123.243.206.49]) by smtp.gmail.com with ESMTPSA id g13-20020a170902c38d00b001d8a920387csm2108433plg.148.2024.01.27.12.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 12:51:26 -0800 (PST) Message-ID: <65b56cce.170a0220.25f58.78f9@mx.google.com> X-Google-Original-Message-ID: <ZbVsyLmw/UuERTik@Thaum.> Date: Sun, 28 Jan 2024 07:51:20 +1100 From: Nathaniel Shead <nathanieloshead@gmail.com> To: gcc-patches@gcc.gnu.org Cc: Nathan Sidwell <nathan@acm.org>, Jason Merrill <jason@redhat.com> Subject: [PATCH] c++/modules: Handle error header names in modules [PR107594] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789278264908294959 X-GMAIL-MSGID: 1789278264908294959 |
Series |
c++/modules: Handle error header names in modules [PR107594]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Nathaniel Shead
Jan. 27, 2024, 8:51 p.m. UTC
I don't provide a new test because this error only happens when there
are no include paths at all, and I haven't worked out a way to get this
to happen within DejaGNU (as it adds a number of `-B` and `-I` flags).
Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk?
-- >8 --
When there are no include paths while preprocessing a header-name token,
an empty STRING_CST is returned. This patch ensures this is handled when
attempting to create a module for this name.
PR c++/107594
gcc/cp/ChangeLog:
* module.cc (get_module): Bail on empty name.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
---
gcc/cp/module.cc | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On 1/27/24 15:51, Nathaniel Shead wrote: > I don't provide a new test because this error only happens when there > are no include paths at all, and I haven't worked out a way to get this > to happen within DejaGNU (as it adds a number of `-B` and `-I` flags). > > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? OK. > -- >8 -- > > When there are no include paths while preprocessing a header-name token, > an empty STRING_CST is returned. This patch ensures this is handled when > attempting to create a module for this name. > > PR c++/107594 > > gcc/cp/ChangeLog: > > * module.cc (get_module): Bail on empty name. > > Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> > --- > gcc/cp/module.cc | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc > index 840c7ef6dab..3c2fef0e3f4 100644 > --- a/gcc/cp/module.cc > +++ b/gcc/cp/module.cc > @@ -14050,6 +14050,12 @@ get_primary (module_state *parent) > module_state * > get_module (tree name, module_state *parent, bool partition) > { > + /* We might be given an empty NAME if preprocessing fails to handle > + a header-name token. */ > + if (name && TREE_CODE (name) == STRING_CST > + && TREE_STRING_LENGTH (name) == 0) > + return nullptr; > + > if (partition) > { > if (!parent)
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 840c7ef6dab..3c2fef0e3f4 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -14050,6 +14050,12 @@ get_primary (module_state *parent) module_state * get_module (tree name, module_state *parent, bool partition) { + /* We might be given an empty NAME if preprocessing fails to handle + a header-name token. */ + if (name && TREE_CODE (name) == STRING_CST + && TREE_STRING_LENGTH (name) == 0) + return nullptr; + if (partition) { if (!parent)