From patchwork Mon Aug 12 13:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1971583 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=J/X3Yqid; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WjFZ64tVjz1yXl for ; Mon, 12 Aug 2024 23:22:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D64023858414 for ; Mon, 12 Aug 2024 13:22:49 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id E689E3858D39 for ; Mon, 12 Aug 2024 13:22:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E689E3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E689E3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723468944; cv=none; b=WtKxzaRhPujK9uizzJKjhtn3cPzg05Gv39la9EXL0iXA5ntT/3WRhyus25UNPnWfxtdkZC+zDQnXH+Zwi8OFfOuTUO/YOs/vF2/NrVupBFsB+rOlEUCE3lPHGGdE95OG3Sk8MAI+4CJwDVxQrZw5WCXQk2QxPurwXupuxcH5wVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723468944; c=relaxed/simple; bh=mpYYHwtVKFjWmqOnYCHN+Fmma2eg/dmQGsnXcQro6Wo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kmhqFBlTuq0rqxj+8zYad03U5MWWeNE20t5OU84Oe6KxVLvvRRf3vZgMTOqlzuzgzGPaNLiH/rYlKrJEWzyj/ha0iMkxcEt3AuShV/EUCOjbcQh9tN4JNzQeG6Ufakas2/f9HHt5i+qm8cF0xSAUHOPglRJLXY5Pe7UoUIpFLyA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3687ea0521cso3181929f8f.1 for ; Mon, 12 Aug 2024 06:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1723468941; x=1724073741; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M8vh78j19SsFwzcVeb3EkzSPYrDe7ig7fUbM5Pvg88M=; b=J/X3YqidavDVQ8kopqZoVRDq/MrcCLdh1txzR6F2s3BNy3EGcWxfsic8oM5yAZuLEh PU5S7Kuvp+PZvzsMOrXHOVxOwkMePDFtTAwh0dcKbC82kst8c3Ucw39s5llvlh0Jtaft oY+pyGxSn0Jfl37ClFotG02vQsKAkETXaM9Q1MRryXq83MBhOp1kRKa++aOJ6slxUvKW 76OqGieuypwFuUYR2FcgrVbwgRk3wscuPfsgKp8a0ThCmCJvg4Wndqfd4Sw++v9/qz1E y1wTAwkYbimXiWdOBjoRb7gCL4mOXx7THdyBY+Sjk8qnFR8RNqUM36rDPRtxXg6crDs4 RLoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723468941; x=1724073741; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M8vh78j19SsFwzcVeb3EkzSPYrDe7ig7fUbM5Pvg88M=; b=rgWqVhMgG/1i5Z6CCmi/8bE1kLKmg+IEJG+zfibF0faslLY+gUzEFsBS37CjNWF+lT lvIeKLy0LPysP4+O3XDZ21UYzBl82nQTBFeiRYScTlaqd0dkdoqB45X/krp+5GPpbIq4 8Qkf1Rq3LFzOYqJ4yHR97WqFv0x7jnS3cSgiF7tFzQWl201MviC4nrKEuKSS7Xz0e2P/ eVaklPF47Dz3A6gc8h82H5Xbe8q2hji9aHDYScGsPjbxhkaEgTRNd/dShYM2QAUVlIlY q4dMuoGhMlNdEDlpqTeocjv8jQkCtNgKVAM7LrXNBUgR08KgTj73Cxb6dOGTLDYKD+QA p/ag== X-Gm-Message-State: AOJu0Yy2Uuu2OR3LaPWBHoFOdXMHK8Y18jdxyqP0yVIlhZRuq9PO17Z1 zgnLvo+mGYjXIvD0AcRRY4q2ffxXSjpHihSlUcYRBlYX9IahzbC1+KVtzt0OeDjagbB4L41Ff2X nheJ4 X-Google-Smtp-Source: AGHT+IF6iJAdU46qheqZv1wFOVtkx3mmAcfuO8AqVKxc/ENv9wTH9BQsboyinvWEv+VtUUuuE8o0RA== X-Received: by 2002:adf:e84c:0:b0:36b:3563:15f4 with SMTP id ffacd0b85a97d-3716cd250ffmr327959f8f.56.1723468941222; Mon, 12 Aug 2024 06:22:21 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:a:54cc:15e3:2d53:fbdb:a896]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4ecc7a47sm7494117f8f.105.2024.08.12.06.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:22:20 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [COMMITTED 1/2] borrowck: Avoid overloading issues on 32bit architectures Date: Mon, 12 Aug 2024 15:22:38 +0200 Message-ID: <20240812132301.94279-1-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org On architectures where `size_t` is `unsigned int`, such as 32bit x86, we encounter an issue with `PlaceId` and `FreeRegion` being aliases to the same types. This poses an issue for overloading functions for these two types, such as `push_subset` in that case. This commit renames one of these `push_subset` functions to avoid the issue, but this should be fixed with a newtype pattern for these two types. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-fact-collector.h (points): Rename `push_subset(PlaceId, PlaceId)` to `push_subset_place(PlaceId, PlaceId)` --- gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h b/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h index bb8fedaf3db..6601c981779 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h @@ -334,7 +334,7 @@ protected: // Main collection entry points (for different categories). expr.get_rhs () - 1, current_bb, current_stmt); issue_read_move (expr.get_rhs ()); - push_subset (lhs, expr.get_rhs ()); + push_place_subset (lhs, expr.get_rhs ()); } void visit (const CallExpr &expr) override @@ -660,7 +660,7 @@ protected: // Subset helpers. } } - void push_subset (PlaceId lhs, PlaceId rhs) + void push_place_subset (PlaceId lhs, PlaceId rhs) { auto &lhs_place = place_db[lhs]; auto &rhs_place = place_db[rhs]; From patchwork Mon Aug 12 13:22:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1971584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=W/jE3muM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WjFZD6Qqhz1yXl for ; Mon, 12 Aug 2024 23:23:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB8903858C5F for ; Mon, 12 Aug 2024 13:22:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id F280C3858D34 for ; Mon, 12 Aug 2024 13:22:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F280C3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F280C3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723468954; cv=none; b=VGdMFL6EYi/XV8r5F4i1t4igVR19jCc+nsVbAnTnSNS+OkpZbyDBAmH6yefcFStthaerLvcAbqfLv1YiEAn6ygj2EBxFoNFggjTNnwPQHgOU4IgDcWB7WP2VIVDmF40qKrUq//BkYFnmKShk/DgXAkLsHdsb+Z/H7+0ca/ffXwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723468954; c=relaxed/simple; bh=T835q6r4MGjtayKju/lL3luFfyDmGMiz0MIcS8iThvY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TFlgp+l4la3kU0LHt1Muz2WbSgIS4SmGLwAVVUlxOtUD52IbaI7hB7dbQyU9b6pFeXpZQ9hBmXfJCxXPlaObC2LqqUCRAWI36vjcWwSarFJNzkgTB8oo7wwzsMpaq2B1Ip7qZ6HQRRv3s3xO0aX0oZve9yGwJe/RYoKhc16CRUk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so30558715e9.2 for ; Mon, 12 Aug 2024 06:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1723468950; x=1724073750; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=83BpHzY5X38b5djApUi90okCTrIfT9QboMVG5/JKC50=; b=W/jE3muMqunesCC4OvX4vGOk2P8onsrulKarcyGcvrAGCoaMVREC0LbyzpygFLqJV+ pTV45nAq6045pDyuxGLteqtYhclK3OoA20/yTnk/Uk+lQePLl+jKQZ+ky+6ZuSv/x1cB WpZiDDm1PYInuz7myX3fOjO8SLzU6W+ZyIi8st9vpfhK7gNxjjGhE83+0UFpSBKBWhPQ P4PpWo6V3m3FZ73Yps7JYpWOL83AaXuZU8Pu1adt8esTOZQRHuaU0nEKJp4ALTQWeP/Q CzDZQbIlbP8fGJ4i9lVtuKtzrQB7rfxEHtc12EZqAoQUzjUkrP3Y2WQ2RA8XmpZZfaLu 1QkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723468950; x=1724073750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=83BpHzY5X38b5djApUi90okCTrIfT9QboMVG5/JKC50=; b=Kcc4xSSNfwjcktmrJIF5ULX70j/JJPtn3kkDGLVSxb6sur1LayVlXmgKd528eVj69F f/ndjhS6MuR0eM+R2aVe4kmMp9c+sbpqDUBrfdf4woNkeHGlmHVti8vq7EmPoO2wVH8L B3VdvqpgB9kWpmAWKlV7Ce1wN9PtDwGwfhV+T6qA5gyLQVtSBQ3rMHq1kCxO4HUiGEOa tfBUr/clLVNX8Kg120Nqz3zAjf9VGh3xyO93zbchlN3N0LXb8sar84FP+bXy+SbyOVeI SbuJmvRjVv4m/dYI9ax7glThZ/4fIcA17lBNJcNQT+Ec/CxxqDpa9G+/jEMUBGqip3Op IeyA== X-Gm-Message-State: AOJu0Yw77H1v0fucYPB82S8UXBEyLNqx9Mmsiqa0AeSb+P/LSxhlGXDm ErH0+gphisMLqh7amErhFU9yjzSYthLgFkoeY5hvQdPOIix9XOO6R+L0N8OC72pyoR0bqS4KWTs Ey+GZ X-Google-Smtp-Source: AGHT+IHv1dv0OWx9XPn8Bm49G4D/M757826N58XnFOk8kF/GekyYfKDPtpRAP7SPJ5d/z+usj84ZnQ== X-Received: by 2002:a05:600c:4f0d:b0:427:9dad:e6ac with SMTP id 5b1f17b1804b1-429d48e7b4cmr2988855e9.34.1723468950249; Mon, 12 Aug 2024 06:22:30 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:a:54cc:15e3:2d53:fbdb:a896]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4ecc7a47sm7494117f8f.105.2024.08.12.06.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 06:22:30 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [COMMITTED 2/2] borrowck: Fix debug prints on 32-bits architectures Date: Mon, 12 Aug 2024 15:22:40 +0200 Message-ID: <20240812132301.94279-3-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240812132301.94279-1-arthur.cohen@embecosm.com> References: <20240812132301.94279-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder.h: Cast size_t values to unsigned long before printing. * checks/errors/borrowck/rust-bir-fact-collector.h: Likewise. --- gcc/rust/checks/errors/borrowck/rust-bir-builder.h | 3 ++- gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder.h b/gcc/rust/checks/errors/borrowck/rust-bir-builder.h index e9108703be1..6b29eaeba5a 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-builder.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder.h @@ -91,7 +91,8 @@ private: ctx.fn_free_regions[bound.second.get_index ()]); auto last_bound = universal_region_bounds.back (); - rust_debug ("\t\t %ld: %ld", last_bound.first, last_bound.second); + rust_debug ("\t\t %lu: %lu", (unsigned long) last_bound.first, + (unsigned long) last_bound.second); } // TODO: handle type_region constraints diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h b/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h index 6601c981779..1cd6b4d480d 100644 --- a/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h +++ b/gcc/rust/checks/errors/borrowck/rust-bir-fact-collector.h @@ -621,14 +621,16 @@ protected: // Generic BIR operations. protected: // Subset helpers. void push_subset (FreeRegion lhs, FreeRegion rhs) { - rust_debug ("\t\tpush_subset: '?%lu: '?%lu", lhs, rhs); + rust_debug ("\t\tpush_subset: '?%lu: '?%lu", (unsigned long) lhs, + (unsigned long) rhs); facts.subset_base.emplace_back (lhs, rhs, get_current_point_mid ()); } void push_subset_all (FreeRegion lhs, FreeRegion rhs) { - rust_debug ("\t\tpush_subset_all: '?%lu: '?%lu", lhs, rhs); + rust_debug ("\t\tpush_subset_all: '?%lu: '?%lu", (unsigned long) lhs, + (unsigned long) rhs); for (auto point : cfg_points_all) facts.subset_base.emplace_back (lhs, rhs, point);