[gcc(refs/vendors/ARM/heads/morello)] cp_build_c_cast: TYPE_PRECISION fix

Matthew Malcomson matmal01@gcc.gnu.org
Mon Feb 28 12:09:20 GMT 2022


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,


More information about the Gcc-cvs mailing list