summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.adb
diff options
context:
space:
mode:
authorbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-05 21:13:00 +0000
committerbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>2001-12-05 21:13:00 +0000
commitdb1260aba33fda8e6448922c02d3b4a9e02dbfdd (patch)
tree2c0ad494ce36ef9b36a04906e911710725525931 /gcc/ada/exp_util.adb
parent554f583982e359a4c0efcff0513c8b1162418290 (diff)
downloadgcc-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/exp_util.adb')
-rw-r--r--gcc/ada/exp_util.adb35
1 files changed, 17 insertions, 18 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 8f64f1634fb..6aeba91bf5f 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -125,11 +125,11 @@ package body Exp_Util is
function Make_Literal_Range
(Loc : Source_Ptr;
- Literal_Typ : Entity_Id;
- Index_Typ : Entity_Id)
+ Literal_Typ : Entity_Id)
return Node_Id;
-- Produce a Range node whose bounds are:
- -- Index_Typ'first .. Index_Typ'First + Length (Literal_Typ)
+ -- Low_Bound (Literal_Type) ..
+ -- Low_Bound (Literal_Type) + Length (Literal_Typ) - 1
-- this is used for expanding declarations like X : String := "sdfgdfg";
function New_Class_Wide_Subtype
@@ -1137,8 +1137,7 @@ package body Exp_Util is
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => New_List (
Make_Literal_Range (Loc,
- Literal_Typ => Exp_Typ,
- Index_Typ => Etype (First_Index (Unc_Type)))))));
+ Literal_Typ => Exp_Typ)))));
elsif Is_Constrained (Exp_Typ)
and then not Is_Class_Wide_Type (Unc_Type)
@@ -2305,28 +2304,27 @@ package body Exp_Util is
function Make_Literal_Range
(Loc : Source_Ptr;
- Literal_Typ : Entity_Id;
- Index_Typ : Entity_Id)
+ Literal_Typ : Entity_Id)
return Node_Id
is
+ Lo : Node_Id :=
+ New_Copy_Tree (String_Literal_Low_Bound (Literal_Typ));
+
begin
+ Set_Analyzed (Lo, False);
+
return
Make_Range (Loc,
- Low_Bound =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Typ, Loc),
- Attribute_Name => Name_First),
+ Low_Bound => Lo,
High_Bound =>
Make_Op_Subtract (Loc,
Left_Opnd =>
Make_Op_Add (Loc,
- Left_Opnd =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Index_Typ, Loc),
- Attribute_Name => Name_First),
- Right_Opnd => Make_Integer_Literal (Loc,
- String_Literal_Length (Literal_Typ))),
+ Left_Opnd => New_Copy_Tree (Lo),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc,
+ String_Literal_Length (Literal_Typ))),
Right_Opnd => Make_Integer_Literal (Loc, 1)));
end Make_Literal_Range;
@@ -2867,7 +2865,8 @@ package body Exp_Util is
-- regressions that are not fully understood yet.
elsif Nkind (Exp) = N_Type_Conversion
- and then not Name_Req
+ and then (not Is_Elementary_Type (Underlying_Type (Exp_Type))
+ or else Nkind (Parent (Exp)) = N_Assignment_Statement)
then
Remove_Side_Effects (Expression (Exp), Variable_Ref);
Scope_Suppress := Svg_Suppress;