https://gcc.gnu.org/g:3b5801409dc15c6fed57750c0c90ae8a4599ab3e

commit 3b5801409dc15c6fed57750c0c90ae8a4599ab3e
Author: Kushal Pal <kushalpal...@gmail.com>
Date:   Fri Jul 26 07:51:43 2024 +0000

    Fixed bitwise operation in `extract_stmt`
    
    gcc/rust/ChangeLog:
    
            * checks/errors/borrowck/polonius/rust-polonius.h (struct 
FullPoint):
            This is the correct way of extracting the required bits.
    
    Signed-off-by: Kushal Pal <kushalpal...@gmail.com>

Diff:
---
 gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h 
b/gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h
index ec6e6910959e..71dbf46f6da1 100644
--- a/gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h
+++ b/gcc/rust/checks/errors/borrowck/polonius/rust-polonius.h
@@ -45,7 +45,7 @@ struct FullPoint
   static uint32_t extract_bb (Point point) { return point >> 16; }
   static uint32_t extract_stmt (Point point)
   {
-    return (point & ~(1 << 16)) >> 1;
+    return (point >> 1) & ((1 << 15) - 1);
   }
   static bool extract_mid (Point point) { return point & 1; }

Reply via email to