public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1675] [Ada] Simplify detection of statically overlapping slices
@ 2021-06-21 11:05 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-21 11:05 UTC (permalink / raw)
  To: gcc-cvs

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

commit r12-1675-gc9fcf011726d2578acfcf58eae05646fce6dae94
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Mar 25 13:17:40 2021 +0100

    [Ada] Simplify detection of statically overlapping slices
    
    gcc/ada/
    
            * sem_util.adb (Denotes_Same_Object): Simplify handling of
            slices.

Diff:
---
 gcc/ada/sem_util.adb | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 6727e15d2d2..b59116e540b 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;


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

only message in thread, other threads:[~2021-06-21 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 11:05 [gcc r12-1675] [Ada] Simplify detection of statically overlapping slices 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).