{"id":2221648,"url":"http://patchwork.ozlabs.org/api/patches/2221648/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260410033404.3011-1-gerris.rs@gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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":"<20260410033404.3011-1-gerris.rs@gmail.com>","list_archive_url":null,"date":"2026-04-10T03:34:04","name":"[gccrs,COMMIT] Fix ICE in unused var when we hit unit const type","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"f5c4467097f6b37fddfb4f08dc26245a94237d6f","submitter":{"id":92092,"url":"http://patchwork.ozlabs.org/api/people/92092/?format=json","name":null,"email":"gerris.rs@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260410033404.3011-1-gerris.rs@gmail.com/mbox/","series":[{"id":499384,"url":"http://patchwork.ozlabs.org/api/series/499384/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499384","date":"2026-04-10T03:34:04","name":"[gccrs,COMMIT] Fix ICE in unused var when we hit unit const type","version":1,"mbox":"http://patchwork.ozlabs.org/series/499384/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221648/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221648/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=BbrNBLOJ;\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=BbrNBLOJ","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=74.125.82.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 4fsMqm3yHnz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 13:34:43 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 18CAE4BA2E2E\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 03:34:41 +0000 (GMT)","from mail-dy1-f179.google.com (mail-dy1-f179.google.com\n [74.125.82.179])\n by sourceware.org (Postfix) with ESMTPS id 5BD304BA2E10\n for <gcc-patches@gcc.gnu.org>; Fri, 10 Apr 2026 03:34:11 +0000 (GMT)","by mail-dy1-f179.google.com with SMTP id\n 5a478bee46e88-2b6b0500e06so2341981eec.1\n for <gcc-patches@gcc.gnu.org>; Thu, 09 Apr 2026 20:34:11 -0700 (PDT)","from\n runnervm35a4x.qtkme5kclwxuvgk1gfqfrwzr2h.dx.internal.cloudapp.net\n ([68.220.56.245]) by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2d55faa586bsm2979115eec.11.2026.04.09.20.34.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 09 Apr 2026 20:34:09 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 18CAE4BA2E2E","OpenDKIM Filter v2.11.0 sourceware.org 5BD304BA2E10"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 5BD304BA2E10","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 5BD304BA2E10","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775792051; cv=none;\n b=Xo6WXCCAmUJbTpG6BZfO6kcav9vI9ci7gfec5DqoS3GUpuL2m8aKMBwS9peVjcjnhLP+P8Qu92GMpYJZVtzpImJN0jvBwOC5YJJsuLdCNlGQRdLEtRkjcPjCuP1VR0Ik9XtvBKllRCScwSo1wS9es+lohQ0jDF7/bnVVyq30WF0=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775792051; c=relaxed/simple;\n bh=O2/yGIQ87iQraESRejMg9fVs2qhuFf1PVJTX8RUQEZ4=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Bs+ddp+951nYzqWCEHVUjBDp2MV0o/nvXhN2cMjQ3QvXZqVXsuUxfGM5Ye7aWA74Kj1co7NpKr3jamo4sYpj8lPfRTfk4EA4cH2CTx1VGsxWN7KsBhSnf1Xfd4NOUG71rgmOkZGyptdsKcLBiPznm4hEPMEO0vusJoFn+aDm0uY=","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=1775792050; x=1776396850; 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=HgwbciIu/AOId6H6DWwCPITw9D2enlQJc+fjxkf7BDg=;\n b=BbrNBLOJHG9vX1HvtDE7cGfjOesoWB4aOI7FYamTS5RmMWaHTvOxYy4K2nkJhGX2im\n Np49N4fK0cIUYcKk1Els7Pq4XQzjORGgZh2wnmUUhKlpoBqlDr9rVZt2eSj3kFfVSv6f\n /oT3jcFdl/FjF8lwojMrZIwt6bTVATOQk6Fw3zaAaa82LIoeFpZ+yKpuzMqPWduVozWM\n QNlr7negp8A1QxildWzHuLe04SLUD/Ft8QmZbqL1Xk4lecww/FSvyNBAx+X5M4hGoeWP\n okYKs/GFnKAT8nxATgkRqhFHbbFPMHTBosBiqfhRyV6yN5C/omD1pJCcM9Cf7Itfe+LO\n 9vsg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775792050; x=1776396850;\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=HgwbciIu/AOId6H6DWwCPITw9D2enlQJc+fjxkf7BDg=;\n b=JVJqtQf4/d8XMU43oAR7ORH9CkQLStIfmVdeYSOXsavTureSvXQy+YSUjiOstmTNGQ\n cRCXdENhcee56DBhVCXdbeX+gONzuOqmUr7jiK3N7p4T9rkueog0lOTWCP2XM5rnfpix\n MhgcNnJklkmSYBXHJazv8tZF5GFw7QwJZYPtT65EDmx8G6nwVFaen2vL0kYgAM087kIl\n zOb0G330xF7HNLuhuGMBobhpKZZdx/ZIxEm21tzNM+FSEnYW74qy0hStFR2bLtOqbGcE\n B13XBmv5JEbozPQ0nV7JMj7dtrJM8Ns2SZN0Bh/88SElSp4LQH69XuYNVfF15oWKwxeb\n PQ2w==","X-Gm-Message-State":"AOJu0Yxd39E960kIJLP03IWYaJ7kWZYLLObwZrbKB986PWUssngIOpUo\n Oxj8aXJjAm1OI36tXo8IJKAOV51Y8JM3ajs7vKbiOmQPaJvy2MgpkjbdxPhUP00B","X-Gm-Gg":"AeBDietF3HsGxEiTSg5yGJ/DEfibovQUvByYIujQ2LdqVfeNKXvDmA69mtaYcWKsCtK\n o0WMudQGTYDzVO0iWfEqKJ2Y1L+sEuro14LfI0r9hmLbLdIRMlx4NetUUEjaFd1TrSTBBS7Shp2\n w6nFRe+3Pf1K2wGWpmvZDXU2NnEzCPh+aSmnAV/FhLt3/kC4V5VVB9VsGcTUY/O6nGohcZAG/EZ\n 1jQHRtjA7tMc91RzQugdtmYPgnU0sy5CGqIRQp2sAGyPqiTdi2cTd8sVDx60qWuLtKvGytDBAfV\n Vx9jzVRjbzFGMe9zjvWrBXevkvRihvnF77DtMyTcRhGJdam2N5n/c2zcYdJEgdqv8tOY89zWcjk\n vB8vrPcQjt+9zN+ewHzHZOUI3J+lzE4cCAweKbkXvyRen7rViDKWkPjFK5xsOdTYk8/s28xqx2w\n Frq+YVihfduKfUYTK5Jhd/ZAAs+lHQiqs5Y6FuRftc5sSPa8iJ1cALBfJgfaQcjtWYRo+QQbqBd\n fAUR8U8PkKb3YiTeUG9Og==","X-Received":"by 2002:a05:7301:228f:b0:2c4:dd55:ffc1 with SMTP id\n 5a478bee46e88-2d586eaa359mr857619eec.2.1775792049912;\n Thu, 09 Apr 2026 20:34:09 -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, Islam-Imad <islamimad404@gmail.com>","Subject":"[gccrs COMMIT] Fix ICE in unused var when we hit unit const type","Date":"Fri, 10 Apr 2026 03:34:04 +0000","Message-ID":"<20260410033404.3011-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: Islam-Imad <islamimad404@gmail.com>\n\nthe problem is compiling if-expr doesn't set translated to unit type.\n\ngcc/rust/ChangeLog:\n\n\t* backend/rust-compile-expr.cc (CompileExpr::visit): set unit type.\n\ngcc/testsuite/ChangeLog:\n\n\t* rust/compile/issue-4517.rs: New test.\n\nSigned-off-by: Islam-Imad <islamimad404@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/c6a1ed545ae5e31f1b74fb5d5c26eb006a96ec9a\n\nThe commit has been mentioned in the following pull-request(s):\n - https://github.com/Rust-GCC/gccrs/pull/4518\n\n gcc/rust/backend/rust-compile-expr.cc    | 8 +++++---\n gcc/testsuite/rust/compile/issue-4517.rs | 5 +++++\n 2 files changed, 10 insertions(+), 3 deletions(-)\n create mode 100644 gcc/testsuite/rust/compile/issue-4517.rs\n\n\nbase-commit: 5c0e4d2c59c681f5f22d31173bf9c17202f60c80","diff":"diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc\nindex 40bd2829f..55b3534a1 100644\n--- a/gcc/rust/backend/rust-compile-expr.cc\n+++ b/gcc/rust/backend/rust-compile-expr.cc\n@@ -360,6 +360,7 @@ CompileExpr::visit (HIR::IfExpr &expr)\n {\n   auto stmt = CompileConditionalBlocks::compile (&expr, ctx, nullptr);\n   ctx->add_statement (stmt);\n+  translated = unit_expression (expr.get_locus ());\n }\n \n void\n@@ -367,9 +368,7 @@ CompileExpr::visit (HIR::InlineAsm &expr)\n {\n   CompileAsm asm_codegen (ctx);\n   ctx->add_statement (asm_codegen.tree_codegen_asm (expr));\n-  // translated = build_asm_expr (0, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,\n-  //\t\t       NULL_TREE, true, true);\n-  // CompileAsm::asm_build_expr (expr);\n+  translated = unit_expression (expr.get_locus ());\n }\n \n void\n@@ -377,6 +376,7 @@ CompileExpr::visit (HIR::LlvmInlineAsm &expr)\n {\n   CompileLlvmAsm asm_codegen (ctx);\n   ctx->add_statement (asm_codegen.tree_codegen_asm (expr));\n+  translated = unit_expression (expr.get_locus ());\n }\n \n void\n@@ -848,6 +848,7 @@ CompileExpr::visit (HIR::WhileLoopExpr &expr)\n \n   tree loop_expr = Backend::loop_expression (loop_block, expr.get_locus ());\n   ctx->add_statement (loop_expr);\n+  translated = unit_expression (expr.get_locus ());\n }\n \n void\n@@ -1099,6 +1100,7 @@ CompileExpr::visit (HIR::AssignmentExpr &expr)\n     = Backend::assignment_statement (lvalue, rvalue, expr.get_locus ());\n \n   ctx->add_statement (assignment);\n+  translated = unit_expression (expr.get_locus ());\n }\n \n // Helper for CompileExpr::visit (HIR::MatchExpr).\ndiff --git a/gcc/testsuite/rust/compile/issue-4517.rs b/gcc/testsuite/rust/compile/issue-4517.rs\nnew file mode 100644\nindex 000000000..9db4082a1\n--- /dev/null\n+++ b/gcc/testsuite/rust/compile/issue-4517.rs\n@@ -0,0 +1,5 @@\n+#![feature(no_core)]\n+#![no_core]\n+\n+const _: () = if true {};\n+const x: () = if true {}; // { dg-warning \"unused name\" \"\" { target *-*-* } }\n","prefixes":["gccrs","COMMIT"]}