]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix detection of overlapping slices indexed by characters
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 23 Mar 2021 00:11:57 +0000 (01:11 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 18 Jun 2021 08:36:54 +0000 (04:36 -0400)
gcc/ada/

* sem_util.adb (Denotes_Same_Object): Handle character literals
just like integer literals.

gcc/ada/sem_util.adb

index 44a4dc21f14e2cf7f287275530559b94604421b2..fb44823d4097dec961e0eac42f4ca9398b9cc496 100644 (file)
@@ -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;