diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-05 21:13:00 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-05 21:13:00 +0000 |
commit | db1260aba33fda8e6448922c02d3b4a9e02dbfdd (patch) | |
tree | 2c0ad494ce36ef9b36a04906e911710725525931 /gcc/ada/sem_eval.adb | |
parent | 554f583982e359a4c0efcff0513c8b1162418290 (diff) | |
download | gcc-db1260aba33fda8e6448922c02d3b4a9e02dbfdd.tar.gz |
* sem_eval.adb (Eval_Concatenation): If left operand is a null string,
get bounds from right operand.
* sem_eval.adb: Minor reformatting
* exp_util.adb (Make_Literal_Range): use bound of literal rather
than Index'First, its lower bound may be different from 1.
* exp_util.adb: Undo earlier change, fixes ACVC regressions C48009B
and C48009J
* prj-nmsc.adb Minor reformatting
* prj-nmsc.adb (Language_Independent_Check): Reset Library flag if
set and libraries are not supported.
* sem_ch3.adb (Build_Derived_Private_Type): set Public status of
private view explicitly, so the back-end can treat as a global
when appropriate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47692 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r-- | gcc/ada/sem_eval.adb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 4a26a7ebcbb..97930a6c1b5 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -1045,11 +1045,11 @@ package body Sem_Eval is -- both operands are static (RM 4.9(7), 4.9(21)). procedure Eval_Concatenation (N : Node_Id) is - Left : constant Node_Id := Left_Opnd (N); - Right : constant Node_Id := Right_Opnd (N); + Left : constant Node_Id := Left_Opnd (N); + Right : constant Node_Id := Right_Opnd (N); + C_Typ : constant Entity_Id := Root_Type (Component_Type (Etype (N))); Stat : Boolean; Fold : Boolean; - C_Typ : constant Entity_Id := Root_Type (Component_Type (Etype (N))); begin -- Concatenation is never static in Ada 83, so if Ada 83 @@ -1090,6 +1090,7 @@ package body Sem_Eval is declare Left_Str : constant Node_Id := Get_String_Val (Left); + Left_Len : Nat; Right_Str : constant Node_Id := Get_String_Val (Right); begin @@ -1101,10 +1102,12 @@ package body Sem_Eval is -- case of a concatenation of a series of string literals. if Nkind (Left_Str) = N_String_Literal then + Left_Len := String_Length (Strval (Left_Str)); Start_String (Strval (Left_Str)); else Start_String; Store_String_Char (Char_Literal_Value (Left_Str)); + Left_Len := 1; end if; -- Now append the characters of the right operand @@ -1125,6 +1128,17 @@ package body Sem_Eval is Set_Is_Static_Expression (N, Stat); if Stat then + + -- If left operand is the empty string, the result is the + -- right operand, including its bounds if anomalous. + + if Left_Len = 0 + and then Is_Array_Type (Etype (Right)) + and then Etype (Right) /= Any_String + then + Set_Etype (N, Etype (Right)); + end if; + Fold_Str (N, End_String); end if; end; |