From: Piotr Trojanek <[email protected]>

A recent change removed rewriting of address of a slice into address of first
component of a slice. Now we need to explicitly detect overlying with slices.
Together, both changes cause warnings to be emitted when slice of a constant
object is overlaid by a variable.

gcc/ada/ChangeLog:

        * sem_util.adb (Find_Overlaid_Entity): Detect overlying with slice.

Tested on x86_64-pc-linux-gnu (before the recent bootstrap breakage), committed 
on master.

---
 gcc/ada/sem_util.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 843bfb4a54b..ad7c0e647f0 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -9251,7 +9251,10 @@ package body Sem_Util is
 
          --  Check for components
 
-         elsif Nkind (Expr) in N_Selected_Component | N_Indexed_Component then
+         elsif Nkind (Expr) in N_Indexed_Component
+                             | N_Selected_Component
+                             | N_Slice
+         then
             Expr := Prefix (Expr);
             Off  := True;
 
-- 
2.51.0

Reply via email to