diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-03-25 13:17:40 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-21 06:45:00 -0400 |
commit | c9fcf011726d2578acfcf58eae05646fce6dae94 (patch) | |
tree | 9a0665964ad1bd3fe112076c8b43a7a955919fd3 /gcc | |
parent | 58484cdf4e7c95dbdc503cf4a8427f44bfe02921 (diff) | |
download | gcc-c9fcf011726d2578acfcf58eae05646fce6dae94.zip gcc-c9fcf011726d2578acfcf58eae05646fce6dae94.tar.gz gcc-c9fcf011726d2578acfcf58eae05646fce6dae94.tar.bz2 |
[Ada] Simplify detection of statically overlapping slices
gcc/ada/
* sem_util.adb (Denotes_Same_Object): Simplify handling of
slices.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_util.adb | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 6727e15..b59116e 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -7462,9 +7462,12 @@ package body Sem_Util is -- Check whether bounds are statically identical. There is no -- attempt to detect partial overlap of slices. - return Denotes_Same_Object (Lo1, Lo2) - and then - Denotes_Same_Object (Hi1, Hi2); + return Is_OK_Static_Expression (Lo1) + and then Is_OK_Static_Expression (Lo2) + and then Is_OK_Static_Expression (Hi1) + and then Is_OK_Static_Expression (Hi2) + and then Expr_Value (Lo1) = Expr_Value (Lo2) + and then Expr_Value (Hi1) = Expr_Value (Hi2); end; end if; @@ -7485,20 +7488,6 @@ package body Sem_Util is then return Denotes_Same_Object (A1, Renamed_Entity (Entity (A2))); - -- In the recursion, integer literals appear as slice bounds - - elsif Nkind (A1) = N_Integer_Literal - and then Nkind (A2) = N_Integer_Literal - then - return Intval (A1) = Intval (A2); - - -- Likewise for character literals - - elsif Nkind (A1) = N_Character_Literal - and then Nkind (A2) = N_Character_Literal - then - return Char_Literal_Value (A1) = Char_Literal_Value (A2); - else return False; end if; |