[gcc r16-6603] ada: Find overlying with slices
Marc Poulhies
dkm@gcc.gnu.org
Fri Jan 9 11:00:47 GMT 2026
https://gcc.gnu.org/g:315965cf4e47118152e7e9bf7086ccf833cafa91
commit r16-6603-g315965cf4e47118152e7e9bf7086ccf833cafa91
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Tue Nov 25 11:29:28 2025 +0100
ada: Find overlying with slices
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.
Diff:
---
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 843bfb4a54be..ad7c0e647f09 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;
More information about the Gcc-cvs
mailing list