diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-03-23 01:11:57 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-18 04:36:54 -0400 |
commit | b3fa853abad9d7f2e2d5d77a200db20a4d4f0280 (patch) | |
tree | 140abc2e8c953f7081e4b15fb9f5aab60077fc56 | |
parent | cbe87f458252d3d25288d261703d79277943848e (diff) | |
download | gcc-b3fa853abad9d7f2e2d5d77a200db20a4d4f0280.zip gcc-b3fa853abad9d7f2e2d5d77a200db20a4d4f0280.tar.gz gcc-b3fa853abad9d7f2e2d5d77a200db20a4d4f0280.tar.bz2 |
[Ada] Fix detection of overlapping slices indexed by characters
gcc/ada/
* sem_util.adb (Denotes_Same_Object): Handle character literals
just like integer literals.
-rw-r--r-- | gcc/ada/sem_util.adb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 44a4dc2..fb44823 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -7504,13 +7504,20 @@ package body Sem_Util is then return Denotes_Same_Object (A1, Renamed_Entity (Entity (A2))); - -- In the recursion, literals appear as slice bounds + -- 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; |