diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2022-08-02 19:46:36 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-09-05 09:21:07 +0200 |
commit | 3424f4c34d04541005ca6d255a04d5f2f613f6b0 (patch) | |
tree | efa54da3d9ff5756360361bbfac72ad039c5a8e5 /gcc/ada/sem_aggr.adb | |
parent | 59a23beb9e71a0259b076693dd1e551500c08f24 (diff) | |
download | gcc-3424f4c34d04541005ca6d255a04d5f2f613f6b0.zip gcc-3424f4c34d04541005ca6d255a04d5f2f613f6b0.tar.gz gcc-3424f4c34d04541005ca6d255a04d5f2f613f6b0.tar.bz2 |
[Ada] Move check for null array aggregates to expansion
Despite recent changes to runtime checks for null array aggregates,
GNATprove still struggles with N_Raise_Constraint_Error nodes inserted
into AST by aggregate resolution. The ultimate fix is to move these
checks to expansion (which is disabled in GNATprove mode) and explicitly
emit a proof check in the GNATprove backend.
gcc/ada/
* exp_aggr.adb (Check_Bounds): Move code and comment related to
check for null array aggregate from Resolve_Null_Array_Aggregate.
* sem_aggr.ads (Is_Null_Aggregate): Move spec from unit body.
* sem_aggr.adb (Resolve_Null_Array_Aggregate): Move check to
expansion.
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 8da4f80..258e4ad 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -404,10 +404,6 @@ package body Sem_Aggr is -- The bounds of the aggregate itype are cooked up to look reasonable -- (in this particular case the bounds will be 1 .. 2). - function Is_Null_Aggregate (N : Node_Id) return Boolean; - -- Returns True for a "[]" aggregate (an Ada 2022 feature), even after - -- it has been transformed by expansion. Returns False otherwise. - procedure Make_String_Into_Aggregate (N : Node_Id); -- A string literal can appear in a context in which a one dimensional -- array of characters is expected. This procedure simply rewrites the @@ -419,9 +415,6 @@ package body Sem_Aggr is -- is constrained). If the subtype is unconstrained, then the bounds -- are determined in much the same way as the bounds for a null string -- literal with no applicable index constraint. - -- Emit a check that the bounds for each dimension define a null - -- range; no check is emitted if it is statically known that the - -- check would succeed. --------------------------------- -- Delta aggregate processing -- @@ -4102,7 +4095,6 @@ package body Sem_Aggr is Loc : constant Source_Ptr := Sloc (N); Typ : constant Entity_Id := Etype (N); - Check : Node_Id; Index : Node_Id; Lo, Hi : Node_Id; Constr : constant List_Id := New_List; @@ -4127,18 +4119,6 @@ package body Sem_Aggr is Attribute_Name => Name_Pred, Expressions => New_List (New_Copy_Tree (Lo))); - -- Check that high bound (i.e., low bound predecessor) exists. - -- Fail if low bound is low bound of base subtype (in all cases, - -- including modular). - - Check := - Make_Raise_Constraint_Error (Loc, - Condition => - Make_Op_Le (Loc, New_Copy_Tree (Lo), New_Copy_Tree (Hi)), - Reason => CE_Range_Check_Failed); - - Insert_Action (N, Check); - Append (Make_Range (Loc, New_Copy_Tree (Lo), Hi), Constr); Analyze_And_Resolve (Last (Constr), Etype (Index)); |