From: Piotr Trojanek Date: Tue, 23 Mar 2021 00:11:57 +0000 (+0100) Subject: [Ada] Fix detection of overlapping slices indexed by characters X-Git-Tag: basepoints/gcc-13~6676 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3fa853abad9d7f2e2d5d77a200db20a4d4f0280;p=thirdparty%2Fgcc.git [Ada] Fix detection of overlapping slices indexed by characters gcc/ada/ * sem_util.adb (Denotes_Same_Object): Handle character literals just like integer literals. --- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 44a4dc21f14e..fb44823d4097 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;