sem_eval.adb (Compare_Fixup): get the bounds of a String_Literal properly.
authorEd Schonberg <schonber@gnat.com>
Fri, 12 Oct 2001 00:32:42 +0000 (00:32 +0000)
committerGeert Bosch <bosch@gcc.gnu.org>
Fri, 12 Oct 2001 00:32:42 +0000 (02:32 +0200)
* sem_eval.adb (Compare_Fixup): get the bounds of a String_Literal
properly. Fixes regression on ACATS C34005G.

From-SVN: r46216

gcc/ada/ChangeLog
gcc/ada/sem_eval.adb

index 942f41849b99ad3eea99737fdc6d81aa8ea84536..2ab878c5743e86def16ca9dbcadbd32c66cd0371 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-11  Ed Schonberg <schonber@gnat.com>
+
+       * sem_eval.adb (Compare_Fixup): get the bounds of a String_Literal 
+       properly. Fixes regression on ACATS C34005G.
+
 2001-10-11  Robert Dewar <dewar@gnat.com>
 
        * sem_ch5.adb (Analyze_Iteration_Scheme): Suppress warning on null 
index dde46a4b48762911d72950f0f41d42ef30edd202..4a26a7ebcbbf770c4a295ca05a8482fcbc9ffa81 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.291 $
+--                            $Revision$
 --                                                                          --
 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
 --                                                                          --
@@ -450,6 +450,17 @@ package body Sem_Eval is
                return N;
             end if;
 
+            if Ekind (Xtyp) = E_String_Literal_Subtype then
+               if Attribute_Name (N) = Name_First then
+                  return String_Literal_Low_Bound (Xtyp);
+
+               else         -- Attribute_Name (N) = Name_Last
+                  return Make_Integer_Literal (Sloc (N),
+                    Intval => Intval (String_Literal_Low_Bound (Xtyp))
+                       + String_Literal_Length (Xtyp));
+               end if;
+            end if;
+
             --  Find correct index type
 
             Indx := First_Index (Xtyp);