From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id E2299385801A; Mon, 28 Feb 2022 12:09:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2299385801A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] cp_build_c_cast: TYPE_PRECISION fix X-Act-Checkin: gcc X-Git-Author: Alex Coplan X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 060ab6aa2f69fc61fb35c598026917bee7269ff9 X-Git-Newrev: c765078578688e8a16e6632c7180b0b2389ccd55 Message-Id: <20220228120920.E2299385801A@sourceware.org> Date: Mon, 28 Feb 2022 12:09:20 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2022 12:09:21 -0000 https://gcc.gnu.org/g:c765078578688e8a16e6632c7180b0b2389ccd55 commit c765078578688e8a16e6632c7180b0b2389ccd55 Author: Alex Coplan Date: Fri Jan 28 10:44:41 2022 +0000 cp_build_c_cast: TYPE_PRECISION fix Use TYPE_NONCAP_PRECISION to compare the precision of the capabilities' address values with the precision of the integer from which we're casting. Diff: --- gcc/cp/typeck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index ac30f4b4133..5de36ddf0ce 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -8299,7 +8299,7 @@ cp_build_c_cast (location_t loc, tree type, tree expr, if (TYPE_PTR_P (type) && TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE /* Casting to an integer of smaller size is an error detected elsewhere. */ - && TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (value)) + && TYPE_NONCAP_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (value)) /* Don't warn about converting any constant. */ && !TREE_CONSTANT (value)) warning_at (loc, OPT_Wint_to_pointer_cast,