aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/exp_aggr.adb8
-rw-r--r--gcc/ada/exp_ch4.adb27
-rw-r--r--gcc/ada/exp_ch4.ads1
-rw-r--r--gcc/ada/exp_util.adb2
-rw-r--r--gcc/ada/expander.adb3
-rw-r--r--gcc/ada/gen_il-gen-gen_nodes.adb6
-rw-r--r--gcc/ada/gen_il-internals.ads1
-rw-r--r--gcc/ada/gen_il-types.ads1
-rw-r--r--gcc/ada/pprint.adb4
-rw-r--r--gcc/ada/sem.adb3
-rw-r--r--gcc/ada/sem_ch4.adb13
-rw-r--r--gcc/ada/sem_ch4.ads1
-rw-r--r--gcc/ada/sem_res.adb21
-rw-r--r--gcc/ada/sem_util.adb1
-rw-r--r--gcc/ada/sinfo.ads33
-rw-r--r--gcc/ada/sprint.adb6
-rw-r--r--gcc/ada/tbuild.adb11
-rw-r--r--gcc/ada/tbuild.ads6
18 files changed, 23 insertions, 125 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 8231e40..d5e238b 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -1329,12 +1329,12 @@ package body Exp_Aggr is
-- If we get here then we are at a bottom-level (sub-)aggregate
Indexed_Comp :=
- Checks_Off
- (Make_Indexed_Component (Loc,
- Prefix => New_Copy_Tree (Into),
- Expressions => New_Indexes));
+ Make_Indexed_Component (Loc,
+ Prefix => New_Copy_Tree (Into),
+ Expressions => New_Indexes);
Set_Assignment_OK (Indexed_Comp);
+ Set_Kill_Range_Check (Indexed_Comp);
-- Ada 2005 (AI-287): In case of default initialized component, Expr
-- is not present (and therefore we also initialize Expr_Q to empty).
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index c16e09d..9e82b78 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -7307,10 +7307,7 @@ package body Exp_Ch4 is
begin
loop
- if Nkind (Parnt) = N_Unchecked_Expression then
- null;
-
- elsif Nkind (Parnt) = N_Object_Renaming_Declaration then
+ if Nkind (Parnt) = N_Object_Renaming_Declaration then
return;
elsif Nkind (Parnt) in N_Subprogram_Call
@@ -12116,22 +12113,6 @@ package body Exp_Ch4 is
end if;
end Expand_N_Type_Conversion;
- -----------------------------------
- -- Expand_N_Unchecked_Expression --
- -----------------------------------
-
- -- Remove the unchecked expression node from the tree. Its job was simply
- -- to make sure that its constituent expression was handled with checks
- -- off, and now that is done, we can remove it from the tree, and indeed
- -- must, since Gigi does not expect to see these nodes.
-
- procedure Expand_N_Unchecked_Expression (N : Node_Id) is
- Exp : constant Node_Id := Expression (N);
- begin
- Set_Assignment_OK (Exp, Assignment_OK (N) or else Assignment_OK (Exp));
- Rewrite (N, Exp);
- end Expand_N_Unchecked_Expression;
-
----------------------------------------
-- Expand_N_Unchecked_Type_Conversion --
----------------------------------------
@@ -12150,7 +12131,11 @@ package body Exp_Ch4 is
-- an Assignment_OK indication which must be propagated to the operand.
if Operand_Type = Target_Type then
- Expand_N_Unchecked_Expression (N);
+ if Assignment_OK (N) then
+ Set_Assignment_OK (Operand);
+ end if;
+
+ Rewrite (N, Operand);
return;
end if;
diff --git a/gcc/ada/exp_ch4.ads b/gcc/ada/exp_ch4.ads
index 7bc777e..22ffdc6 100644
--- a/gcc/ada/exp_ch4.ads
+++ b/gcc/ada/exp_ch4.ads
@@ -71,7 +71,6 @@ package Exp_Ch4 is
procedure Expand_N_Selected_Component (N : Node_Id);
procedure Expand_N_Slice (N : Node_Id);
procedure Expand_N_Type_Conversion (N : Node_Id);
- procedure Expand_N_Unchecked_Expression (N : Node_Id);
procedure Expand_N_Unchecked_Type_Conversion (N : Node_Id);
function Build_Eq_Call
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index df10891..7671910 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -8340,7 +8340,6 @@ package body Exp_Util is
| N_Terminate_Alternative
| N_Triggering_Alternative
| N_Type_Conversion
- | N_Unchecked_Expression
| N_Unchecked_Type_Conversion
| N_Unconstrained_Array_Definition
| N_Unused_At_End
@@ -14259,7 +14258,6 @@ package body Exp_Util is
when N_Qualified_Expression
| N_Type_Conversion
- | N_Unchecked_Expression
=>
return Side_Effect_Free (Expression (N), Name_Req, Variable_Ref);
diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb
index 39b311f..05dcbc0 100644
--- a/gcc/ada/expander.adb
+++ b/gcc/ada/expander.adb
@@ -506,9 +506,6 @@ package body Expander is
when N_Type_Conversion =>
Expand_N_Type_Conversion (N);
- when N_Unchecked_Expression =>
- Expand_N_Unchecked_Expression (N);
-
when N_Unchecked_Type_Conversion =>
Expand_N_Unchecked_Type_Conversion (N);
diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index e0e0538..b322f3c 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -478,7 +478,8 @@ begin -- Gen_IL.Gen.Gen_Nodes
(Sy (Prefix, Node_Id),
Sy (Expressions, List_Id, Default_No_List),
Sm (Atomic_Sync_Required, Flag),
- Sm (Generalized_Indexing, Node_Id)));
+ Sm (Generalized_Indexing, Node_Id),
+ Sm (Kill_Range_Check, Flag)));
Cc (N_Null, N_Subexpr);
@@ -575,9 +576,6 @@ begin -- Gen_IL.Gen.Gen_Nodes
Sm (Float_Truncate, Flag),
Sm (Rounded_Result, Flag)));
- Cc (N_Unchecked_Expression, N_Subexpr,
- (Sy (Expression, Node_Id, Default_Empty)));
-
Cc (N_Unchecked_Type_Conversion, N_Subexpr,
(Sy (Subtype_Mark, Node_Id, Default_Empty),
Sy (Expression, Node_Id, Default_Empty),
diff --git a/gcc/ada/gen_il-internals.ads b/gcc/ada/gen_il-internals.ads
index 31e81c1..46d38d0 100644
--- a/gcc/ada/gen_il-internals.ads
+++ b/gcc/ada/gen_il-internals.ads
@@ -458,7 +458,6 @@ package Gen_IL.Internals is
E_Generic_Function => 1292, -- (0.000) 41 slots
E_Enumeration_Type => 1186, -- (0.000) 47 slots
N_Enumeration_Type_Definition => 1169, -- (0.000) 6 slots
- N_Unchecked_Expression => 1112, -- (0.000) 7 slots
N_Op_Or => 1107, -- (0.000) 8 slots
N_Designator => 1100, -- (0.000) 9 slots
N_Formal_Discrete_Type_Definition => 1086, -- (0.000) 4 slots
diff --git a/gcc/ada/gen_il-types.ads b/gcc/ada/gen_il-types.ads
index 4a739043..66e9b69 100644
--- a/gcc/ada/gen_il-types.ads
+++ b/gcc/ada/gen_il-types.ads
@@ -271,7 +271,6 @@ package Gen_IL.Types is
N_Slice,
N_Target_Name,
N_Type_Conversion,
- N_Unchecked_Expression,
N_Unchecked_Type_Conversion,
N_Subtype_Indication,
N_Component_Declaration,
diff --git a/gcc/ada/pprint.adb b/gcc/ada/pprint.adb
index fbf0e59..b5935fc 100644
--- a/gcc/ada/pprint.adb
+++ b/gcc/ada/pprint.adb
@@ -424,9 +424,7 @@ package body Pprint is
end if;
end;
- when N_Expression_With_Actions
- | N_Unchecked_Expression
- =>
+ when N_Expression_With_Actions =>
return Expr_Name (Expression (Expr));
when N_Raise_Constraint_Error =>
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index cfd0493..c6d65ea 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -613,9 +613,6 @@ package body Sem is
when N_Type_Conversion =>
Analyze_Type_Conversion (N);
- when N_Unchecked_Expression =>
- Analyze_Unchecked_Expression (N);
-
when N_Unchecked_Type_Conversion =>
Analyze_Unchecked_Type_Conversion (N);
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index c1f6622..ad18e82 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6488,19 +6488,6 @@ package body Sem_Ch4 is
Operator_Check (N);
end Analyze_Unary_Op;
- ----------------------------------
- -- Analyze_Unchecked_Expression --
- ----------------------------------
-
- procedure Analyze_Unchecked_Expression (N : Node_Id) is
- Expr : constant Node_Id := Expression (N);
-
- begin
- Analyze (Expr, Suppress => All_Checks);
- Set_Etype (N, Etype (Expr));
- Save_Interps (Expr, N);
- end Analyze_Unchecked_Expression;
-
---------------------------------------
-- Analyze_Unchecked_Type_Conversion --
---------------------------------------
diff --git a/gcc/ada/sem_ch4.ads b/gcc/ada/sem_ch4.ads
index dbe0f9a..574613d 100644
--- a/gcc/ada/sem_ch4.ads
+++ b/gcc/ada/sem_ch4.ads
@@ -50,7 +50,6 @@ package Sem_Ch4 is
procedure Analyze_Slice (N : Node_Id);
procedure Analyze_Type_Conversion (N : Node_Id);
procedure Analyze_Unary_Op (N : Node_Id);
- procedure Analyze_Unchecked_Expression (N : Node_Id);
procedure Analyze_Unchecked_Type_Conversion (N : Node_Id);
procedure Ambiguous_Operands (N : Node_Id);
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 658f9eb..d2b019a 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -242,7 +242,6 @@ package body Sem_Res is
procedure Resolve_Target_Name (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Type_Conversion (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Unary_Op (N : Node_Id; Typ : Entity_Id);
- procedure Resolve_Unchecked_Expression (N : Node_Id; Typ : Entity_Id);
procedure Resolve_Unchecked_Type_Conversion (N : Node_Id; Typ : Entity_Id);
function Operator_Kind
@@ -3534,9 +3533,6 @@ package body Sem_Res is
when N_Type_Conversion =>
Resolve_Type_Conversion (N, Ctx_Type);
- when N_Unchecked_Expression =>
- Resolve_Unchecked_Expression (N, Ctx_Type);
-
when N_Unchecked_Type_Conversion =>
Resolve_Unchecked_Type_Conversion (N, Ctx_Type);
end case;
@@ -9730,7 +9726,9 @@ package body Sem_Res is
Resolve (Expr, Etype (Index));
Check_Unset_Reference (Expr);
- Apply_Scalar_Range_Check (Expr, Etype (Index));
+ if not Kill_Range_Check (N) then
+ Apply_Scalar_Range_Check (Expr, Etype (Index));
+ end if;
Next_Index (Index);
Next (Expr);
@@ -12871,19 +12869,6 @@ package body Sem_Res is
end;
end Resolve_Unary_Op;
- ----------------------------------
- -- Resolve_Unchecked_Expression --
- ----------------------------------
-
- procedure Resolve_Unchecked_Expression
- (N : Node_Id;
- Typ : Entity_Id)
- is
- begin
- Resolve (Expression (N), Typ, Suppress => All_Checks);
- Set_Etype (N, Typ);
- end Resolve_Unchecked_Expression;
-
---------------------------------------
-- Resolve_Unchecked_Type_Conversion --
---------------------------------------
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 25f164f..b1b3891 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -18483,7 +18483,6 @@ package body Sem_Util is
when N_Allocator
| N_Qualified_Expression
| N_Type_Conversion
- | N_Unchecked_Expression
| N_Unchecked_Type_Conversion
=>
-- Subpool_Handle_Name and Subtype_Mark are left out because
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 7ed6fad..09385e9 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1909,9 +1909,11 @@ package Sinfo is
-- for further details.
-- Kill_Range_Check
- -- Used in an N_Unchecked_Type_Conversion node to indicate that the
- -- result should not be subjected to range checks. This is used for the
- -- implementation of Normalize_Scalars.
+ -- Used in N_Indexed_Component to indicate that its expressions should
+ -- not be subjected to range checks and in N_Unchecked_Type_Conversion
+ -- to indicate that the result of the conversion should not be subjected
+ -- to range checks. This is used for the implementation of aggregates and
+ -- Normalize_Scalars respectively.
-- Label_Construct
-- Used in an N_Implicit_Label_Declaration node. Refers to an N_Label,
@@ -3830,8 +3832,9 @@ package Sinfo is
-- Sloc contains a copy of the Sloc value of the Prefix
-- Prefix
-- Expressions
- -- Generalized_Indexing
-- Atomic_Sync_Required
+ -- Generalized_Indexing
+ -- Kill_Range_Check
-- plus fields for expression
-- Note: if any of the subscripts requires a range check, then the
@@ -8428,28 +8431,6 @@ package Sinfo is
-- with the N_In node (or a rewriting thereof) corresponding to a
-- classwide membership test.
- --------------------------
- -- Unchecked Expression --
- --------------------------
-
- -- An unchecked expression is one that must be analyzed and resolved
- -- with all checks off, regardless of the current setting of scope
- -- suppress flags.
-
- -- Sprint syntax: `(expression)
-
- -- Note: this node is always removed from the tree (and replaced by
- -- its constituent expression) on completion of analysis, so it only
- -- appears in intermediate trees, and will never be seen by Gigi.
-
- -- N_Unchecked_Expression
- -- Sloc is a copy of the Sloc of the expression
- -- Expression
- -- plus fields for expression
-
- -- Note: in the case where a debug source file is generated, the Sloc
- -- for this node points to the back quote in the Sprint file output.
-
-------------------------------
-- Unchecked Type Conversion --
-------------------------------
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 321fd7f..614bcc1 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -3550,12 +3550,6 @@ package body Sprint is
Sprint_Node (Expression (Node));
Write_Char (')');
- when N_Unchecked_Expression =>
- Col_Check (10);
- Write_Str ("`(");
- Sprint_Node_Sloc (Expression (Node));
- Write_Char (')');
-
when N_Unchecked_Type_Conversion =>
Sprint_Node (Subtype_Mark (Node));
Write_Char ('!');
diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
index b538911..3115426 100644
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -100,17 +100,6 @@ package body Tbuild is
end Add_Unique_Serial_Number;
----------------
- -- Checks_Off --
- ----------------
-
- function Checks_Off (N : Node_Id) return Node_Id is
- begin
- return
- Make_Unchecked_Expression (Sloc (N),
- Expression => N);
- end Checks_Off;
-
- ----------------
-- Convert_To --
----------------
diff --git a/gcc/ada/tbuild.ads b/gcc/ada/tbuild.ads
index 64296e6..e818bcd 100644
--- a/gcc/ada/tbuild.ads
+++ b/gcc/ada/tbuild.ads
@@ -34,12 +34,6 @@ with Uintp; use Uintp;
package Tbuild is
- function Checks_Off (N : Node_Id) return Node_Id;
- pragma Inline (Checks_Off);
- -- Returns an N_Unchecked_Expression node whose expression is the given
- -- argument. The results is a subexpression identical to the argument,
- -- except that it will be analyzed and resolved with checks off.
-
function Convert_To (Typ : Entity_Id; Expr : Node_Id) return Node_Id;
-- Returns an expression that is a type conversion of expression Expr to
-- type Typ. If the type of Expr is Typ, then no conversion is required.