summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_eval.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 16:00:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-15 16:00:26 +0000
commitba40b4affc67004522f70a179d3667fbedf60167 (patch)
tree5be40e694aeb8be74ad16390f5abbfdfd79db33d /gcc/ada/sem_eval.adb
parent8d8f60b9addfd83e4a016e4bcc397618117ed76e (diff)
downloadgcc-ba40b4affc67004522f70a179d3667fbedf60167.tar.gz
2005-03-08 Robert Dewar <dewar@adacore.com>
Ed Schonberg <schonberg@adacore.com> Richard Kenner <kenner@vlsi1.ultra.nyu.edu> PR ada/19900 * exp_pakd.adb (Create_Packed_Array_Type): Do not set Must_Be_Byte_Aligned for cases where we do not need to use a System.Pack_nn unit. * exp_ch6.adb (Expand_Call): Call Expand_Actuals for functions as well as procedures. Needed now that we do some processing for IN parameters as well. This may well fix some unrelated errors. (Expand_Call): Handle case of unaligned objects (in particular those that come from packed arrays). (Expand_Inlined_Call): If the subprogram is a renaming as body, and the renamed entity is an inherited operation, re-expand the call using the original operation, which is the one to call. Detect attempt to inline parameterless recursive subprogram. (Represented_As_Scalar): Fix to work properly with private types (Is_Possibly_Unaligned_Object): Major rewrite to get a much more accurate estimate. Yields True in far fewer cases than before, improving the quality of code that depends on this test. (Remove_Side_Effects): Properly test for Expansion_Delayed and handle case when it's inside an N_Qualified_Expression. * exp_util.adb (Kill_Dead_Code): For a package declaration, iterate over both visible and private declarations to remove them from tree, and mark subprograms declared in package as eliminated, to prevent spurious use in subsequent compilation of generic units in the context. * exp_util.ads: Minor cleanup in variable names * sem_eval.ads, sem_eval.adb: Minor reformatting (Compile_Time_Known_Bounds): New function git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96493 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r--gcc/ada/sem_eval.adb45
1 files changed, 34 insertions, 11 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index d0d536d68b6..442ca6e2965 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -377,8 +377,7 @@ package body Sem_Eval is
function Compile_Time_Compare
(L, R : Node_Id;
- Rec : Boolean := False)
- return Compare_Result
+ Rec : Boolean := False) return Compare_Result
is
Ltyp : constant Entity_Id := Etype (L);
Rtyp : constant Entity_Id := Etype (R);
@@ -795,6 +794,34 @@ package body Sem_Eval is
end if;
end Compile_Time_Compare;
+ -------------------------------
+ -- Compile_Time_Known_Bounds --
+ -------------------------------
+
+ function Compile_Time_Known_Bounds (T : Entity_Id) return Boolean is
+ Indx : Node_Id;
+ Typ : Entity_Id;
+
+ begin
+ if not Is_Array_Type (T) then
+ return False;
+ end if;
+
+ Indx := First_Index (T);
+ while Present (Indx) loop
+ Typ := Underlying_Type (Etype (Indx));
+ if not Compile_Time_Known_Value (Type_Low_Bound (Typ)) then
+ return False;
+ elsif not Compile_Time_Known_Value (Type_High_Bound (Typ)) then
+ return False;
+ else
+ Next_Index (Indx);
+ end if;
+ end loop;
+
+ return True;
+ end Compile_Time_Known_Bounds;
+
------------------------------
-- Compile_Time_Known_Value --
------------------------------
@@ -3116,8 +3143,7 @@ package body Sem_Eval is
function In_Subrange_Of
(T1 : Entity_Id;
T2 : Entity_Id;
- Fixed_Int : Boolean := False)
- return Boolean
+ Fixed_Int : Boolean := False) return Boolean
is
L1 : Node_Id;
H1 : Node_Id;
@@ -3219,8 +3245,7 @@ package body Sem_Eval is
(N : Node_Id;
Typ : Entity_Id;
Fixed_Int : Boolean := False;
- Int_Real : Boolean := False)
- return Boolean
+ Int_Real : Boolean := False) return Boolean
is
Val : Uint;
Valr : Ureal;
@@ -3400,8 +3425,7 @@ package body Sem_Eval is
(N : Node_Id;
Typ : Entity_Id;
Fixed_Int : Boolean := False;
- Int_Real : Boolean := False)
- return Boolean
+ Int_Real : Boolean := False) return Boolean
is
Val : Uint;
Valr : Ureal;
@@ -3691,9 +3715,8 @@ package body Sem_Eval is
------------------------------------
function Subtypes_Statically_Compatible
- (T1 : Entity_Id;
- T2 : Entity_Id)
- return Boolean
+ (T1 : Entity_Id;
+ T2 : Entity_Id) return Boolean
is
begin
if Is_Scalar_Type (T1) then