public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1637] [Ada] Fix detection of overlapping slices indexed by characters
@ 2021-06-18  8:39 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-18  8:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b3fa853abad9d7f2e2d5d77a200db20a4d4f0280

commit r12-1637-gb3fa853abad9d7f2e2d5d77a200db20a4d4f0280
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Mar 23 01:11:57 2021 +0100

    [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:
---
 gcc/ada/sem_util.adb | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 44a4dc21f14..fb44823d409 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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-18  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  8:39 [gcc r12-1637] [Ada] Fix detection of overlapping slices indexed by characters Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).