{"id":2222654,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2222654/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260413094840.3060-1-gerris.rs@gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260413094840.3060-1-gerris.rs@gmail.com>","list_archive_url":null,"date":"2026-04-13T09:48:40","name":"[gccrs,COMMIT] backend: Prevent error_mark_node from leaking into const context","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bf515c2416608b628b33cf195940f7fbc7a6dc87","submitter":{"id":92092,"url":"http://patchwork.ozlabs.org/api/1.2/people/92092/?format=json","name":null,"email":"gerris.rs@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260413094840.3060-1-gerris.rs@gmail.com/mbox/","series":[{"id":499675,"url":"http://patchwork.ozlabs.org/api/1.2/series/499675/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499675","date":"2026-04-13T09:48:40","name":"[gccrs,COMMIT] backend: Prevent error_mark_node from leaking into const context","version":1,"mbox":"http://patchwork.ozlabs.org/series/499675/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222654/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222654/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=F6Qssoyr;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=F6Qssoyr","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","sourceware.org; spf=pass smtp.mailfrom=gmail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.160.179"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvN0T0s7vz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 19:49:11 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D15E04BA2E0D\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 09:49:09 +0000 (GMT)","from mail-qt1-f179.google.com (mail-qt1-f179.google.com\n [209.85.160.179])\n by sourceware.org (Postfix) with ESMTPS id 3F4DE4BA2E09\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 09:48:43 +0000 (GMT)","by mail-qt1-f179.google.com with SMTP id\n d75a77b69052e-50d58c513dbso32106771cf.2\n for <gcc-patches@gcc.gnu.org>; Mon, 13 Apr 2026 02:48:43 -0700 (PDT)","from\n runnervm35a4x.2osajyitlete3e1bz4zdzzvpig.cx.internal.cloudapp.net\n ([20.55.213.118]) by smtp.gmail.com with ESMTPSA id\n d75a77b69052e-50dd561adc2sm84797831cf.27.2026.04.13.02.48.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 02:48:42 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org D15E04BA2E0D","OpenDKIM Filter v2.11.0 sourceware.org 3F4DE4BA2E09"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 3F4DE4BA2E09","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 3F4DE4BA2E09","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776073723; cv=none;\n b=cvdyQgwQ2nzkBkNoi2SBgofN+wKjXpz2VvqvPRxCRh3hu/AyR9V26XRX1QOPtY9qLzbiHXyopPSdEKrpX3dMQt1jhwCrWEenMs46LVQhIhLJa/XSWiMYcIlrnkwEjNvCstVnbAYoPafGgej8Z00MOUk7SIb8X+r8H+uaGQ/e2Do=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776073723; c=relaxed/simple;\n bh=Xn5zfWxEIBMsA9AgmnSKF6CAHwck7CFcpfnGfzNcLwg=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=aeOiIG4GtsHQr7If2U0PAyVbU7NmAySfZw1xcOFS7lH98sfxTHtdjfpA+koWIMtzaTCIpGd/cULTAiAV/kC2XNEYQdslaVMBwmTyb/v0QFwyW24thZlMZmoHfDLUBcbYLezHnFBg3PA5QdieZgqEkNmMXsqiP7aUagl7S6DUSJo=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776073723; x=1776678523; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=QpBHez2Va1T9yefXxfWNmvKz4TZajgnn6JuWdIvcitM=;\n b=F6QssoyreAdDXrsCsHAf00/N5Aw243t2xlo4roIynJE6goGouW6NxRPm2uWBjckyN/\n 8kP1f83Gr1Tz658HNSDaKT7ll66lim2m06SpZ0IzyymJ3FW5WHo8AXk51+M9ipBRL5qp\n N1HQ9SWED+PVbVBDpYuuDsdWyRqa+GyflUtoMV8dluJFM/VQMpf5vFjwK8H+WOPMT+KI\n X23cFtb4ScBPQMeH7Q4fmAPBOR29+PUaYlbmnjGjIduzjyFFm54b07xE0EJhS3PO3ChD\n 5ZK0c0DjTQAqPr3qGp4cK1CKnIZlujmC81gNxVm/dSRxajbWgWmxNq6XGVi7SuJg1dJ1\n N9YQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776073723; x=1776678523;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=QpBHez2Va1T9yefXxfWNmvKz4TZajgnn6JuWdIvcitM=;\n b=GTJ6FMyeKm4VfIgrxZs9yziQaHwp59WMdBlmxa/zm82E7sYV5L1RUhw4trg5GcFFO/\n YQiCaILRlUZWMpZFxpAw8pT+66W0rTl6isFMPp/DTRfs0xKWQ62OA7RIFSm7jV+ZUXaz\n oeNss46gTITVi0z0iCs64V8B08mL6bZG5Km+EN7QDdg7wCJZJ8jU2Ftj36/ColY/9bvv\n jkCUyVV2zg4d8OGVsnZ4ZDUrFNqgZ3wp2LuWcQQ+ggRGO/QoKKXLI5F6yNZKuJ59GDOs\n z7K6dSNo2Knv4HSJ5tycaC+uROXKznnDsMmA38kjE/PWP0pEKLRo1COORJymplqt9316\n 3EFw==","X-Gm-Message-State":"AOJu0YxsETPzRIMS7OvKLlO2bMwYJMP+7Tmlwc3EXD1n5MbL1kBdRXdp\n 9Js8fAHq8y445VfBWN/tsjKiiaDHbqtDSiaWOEkouSNnr+TnceZsmMmDOqDzxz5T","X-Gm-Gg":"AeBDievb0jMGBnN2FepqCFE1IDTiHax2a5P97lk8w2njPYDoUhAtBWA/egOt6fbvUoT\n pXTl4RPj7N3Us4kZumHv1mtlKhdx3GqwxFvNtaAFwxTHHkSysYH6nVDtXk2LRnnasrz4dzwxWq3\n J7Aira9HSEUFrhGW/2IftJ6UznM2Ew4ijAYQchmuwbInzotX6FIvkZu0XGRyNp1cGdz805nb5FI\n WN/T56RlPe9wFavljqlPkZ0uA3EOnoccfK6bIrOPTIFJ/yNCCbsjNiv6les+fixEFUy9jPmEFQE\n gK2FwBdhL1yr0eVulcHfTuTevSxSysjMYnw4koLSCSxeW16a1notM2xK4PcZgp0RL6oaawAvBF7\n BHdnwoLUNgOwh3sUsUFfUNzbDWY0xj4a/nMUgbpWkH4mieEuoSnSN6bTPeR0dqmL316hnp9qijE\n lmKVseYkJ9RKi+BkeAbrLhMlvp08ASNEzCoFeS9eTwy8Bdz118w1RqzNmV36GubPesYve+q/dEk\n CpgKRIjC7YObQvADD4DHwMwKEtwZ0sN","X-Received":"by 2002:ac8:5f88:0:b0:50d:6838:964c with SMTP id\n d75a77b69052e-50dd5af0776mr209120771cf.18.1776073722578;\n Mon, 13 Apr 2026 02:48:42 -0700 (PDT)","From":"gerris.rs@gmail.com","To":"gcc-patches@gcc.gnu.org,\n\tgcc-rust@gcc.gnu.org","Cc":"pierre-emmanuel.patry@embecosm.com, arthur.cohen@embecosm.com,\n dkm+gccrs@kataplop.net, jayant chauhan <0001jayant@gmail.com>","Subject":"[gccrs COMMIT] backend: Prevent error_mark_node from leaking into\n const context","Date":"Mon, 13 Apr 2026 09:48:40 +0000","Message-ID":"<20260413094840.3060-1-gerris.rs@gmail.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"From: jayant chauhan <0001jayant@gmail.com>\n\nFixes Rust-GCC#3910\n\ngcc/rust/ChangeLog:\n\n\t* backend/rust-compile-item.cc (CompileItem::visit): Do not insert\n\tconst_expr into the context if it is an error_mark_node.\n\t* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n\t* rust/compile/issue-3910.rs: New test.\n\nSigned-off-by: jayant chauhan <0001jayant@gmail.com>\n---\nThis change was merged into the gccrs repository and is posted here for\nupstream visibility and potential drive-by review, as requested by GCC\nrelease managers.\nEach commit email contains a link to its details on github from where you can\nfind the Pull-Request and associated discussions.\n\n\nCommit on github: https://github.com/Rust-GCC/gccrs/commit/f1e56c467f24fe98ee74120ec862ca12a0fb00fc\n\nThe commit has been mentioned in the following pull-request(s):\n - https://github.com/Rust-GCC/gccrs/pull/4438\n\n gcc/rust/backend/rust-compile-implitem.cc |  8 ++++++--\n gcc/rust/backend/rust-compile-item.cc     |  7 +++++--\n gcc/testsuite/rust/compile/issue-3910.rs  | 14 ++++++++++++++\n 3 files changed, 25 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/rust/compile/issue-3910.rs\n\n\nbase-commit: 4b5342014c474e63ddba03ecebc2828e017d691f","diff":"diff --git a/gcc/rust/backend/rust-compile-implitem.cc b/gcc/rust/backend/rust-compile-implitem.cc\nindex f4adaa2dd..c94f439e1 100644\n--- a/gcc/rust/backend/rust-compile-implitem.cc\n+++ b/gcc/rust/backend/rust-compile-implitem.cc\n@@ -44,8 +44,12 @@ CompileTraitItem::visit (HIR::TraitItemConst &constant)\n \t\t\t     resolved_type, canonical_path, const_value_expr,\n \t\t\t     constant.get_locus (),\n \t\t\t     const_value_expr.get_locus ());\n-  ctx->push_const (const_expr);\n-  ctx->insert_const_decl (constant.get_mappings ().get_hirid (), const_expr);\n+  if (const_expr != error_mark_node)\n+    {\n+      ctx->push_const (const_expr);\n+      ctx->insert_const_decl (constant.get_mappings ().get_hirid (),\n+\t\t\t      const_expr);\n+    }\n \n   reference = const_expr;\n }\ndiff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc\nindex 28694361b..f9b003cf5 100644\n--- a/gcc/rust/backend/rust-compile-item.cc\n+++ b/gcc/rust/backend/rust-compile-item.cc\n@@ -129,8 +129,11 @@ CompileItem::visit (HIR::ConstantItem &constant)\n \t\t\t     const_value_expr.get_locus ());\n   ctx->pop_const_context ();\n \n-  ctx->push_const (const_expr);\n-  ctx->insert_const_decl (mappings.get_hirid (), const_expr);\n+  if (const_expr != error_mark_node)\n+    {\n+      ctx->push_const (const_expr);\n+      ctx->insert_const_decl (mappings.get_hirid (), const_expr);\n+    }\n   reference = const_expr;\n }\n \ndiff --git a/gcc/testsuite/rust/compile/issue-3910.rs b/gcc/testsuite/rust/compile/issue-3910.rs\nnew file mode 100644\nindex 000000000..57022943e\n--- /dev/null\n+++ b/gcc/testsuite/rust/compile/issue-3910.rs\n@@ -0,0 +1,14 @@\n+#![feature(no_core)]\n+#![no_core]\n+\n+struct B<const M: u32> {}\n+\n+impl<const M: u32> B<M> {\n+    const M: u32 = M;\n+}\n+\n+struct C;\n+\n+impl<const M: u32> C { // { dg-error \"unconstrained type parameter\" }\n+    const USE_M: u32 = M;\n+}\n\\ No newline at end of file\n","prefixes":["gccrs","COMMIT"]}