public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] cp_build_c_cast: TYPE_PRECISION fix
Date: Mon, 28 Feb 2022 12:09:20 +0000 (GMT)	[thread overview]
Message-ID: <20220228120920.E2299385801A@sourceware.org> (raw)

https://gcc.gnu.org/g:c765078578688e8a16e6632c7180b0b2389ccd55

commit c765078578688e8a16e6632c7180b0b2389ccd55
Author: Alex Coplan <alex.coplan@arm.com>
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,


                 reply	other threads:[~2022-02-28 12:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220228120920.E2299385801A@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).