diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-01-24 16:00:26 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-01-24 16:00:26 +0100 |
commit | 979b94ea4d04a42e00b11d5bb9aa415410f31b06 (patch) | |
tree | 22cbc8113b212b7288ffd3d7ebe17235a9e86205 | |
parent | 8edc33fae4cfe74e0e485e80ab6edcb3d5d1e1de (diff) | |
download | gcc-979b94ea4d04a42e00b11d5bb9aa415410f31b06.zip gcc-979b94ea4d04a42e00b11d5bb9aa415410f31b06.tar.gz gcc-979b94ea4d04a42e00b11d5bb9aa415410f31b06.tar.bz2 |
sinfo.ads: Documentation update.
2014-01-24 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads: Documentation update.
2014-01-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Constant_Redeclaration): New declaration is
illegal if previous one has an initial expression that is an
aggregate expanded into assignments.
2014-01-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Small
code reorganization to remove spurious warning on a loop with
an array element iterator that has a null range.
From-SVN: r207041
-rw-r--r-- | gcc/ada/ChangeLog | 32 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 3 | ||||
-rw-r--r-- | gcc/ada/sem_ch5.adb | 24 | ||||
-rw-r--r-- | gcc/ada/sinfo.ads | 59 |
4 files changed, 96 insertions, 22 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 41a0ed0..59072a6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,35 @@ +2014-01-24 Ed Schonberg <schonberg@adacore.com> + + * sinfo.ads: Documentation update. + +2014-01-24 Ed Schonberg <schonberg@adacore.com> + + * sem_ch3.adb (Constant_Redeclaration): New declaration is + illegal if previous one has an initial expression that is an + aggregate expanded into assignments. + +2014-01-24 Ed Schonberg <schonberg@adacore.com> + + * sem_ch5.adb (Analyze_Loop_Parameter_Specification): Small + code reorganization to remove spurious warning on a loop with + an array element iterator that has a null range. + +2014-01-24 Vincent Celier <celier@adacore.com> + + * make.adb (Binding_Phase): When setting the Ada paths, use + the library ALI dir, not the object dir in libraries. + +2014-01-24 Yannick Moy <moy@adacore.com> + + * sinfo.ads: Add documentation of check flag fields. + +2014-01-24 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb (Resolve_Actuals): If an actual is a view + conversion of a discriminated object, and the formal type is + discriminated and constrained, apply a discriminant check to + the object itself. + 2014-01-24 Robert Dewar <dewar@adacore.com> * prj.adb, prj-env.adb, back_end.adb: Add comment, minor code clean ups. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index cdfc062..014105b 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -11104,10 +11104,13 @@ package body Sem_Ch3 is -- If previous full declaration or a renaming declaration exists, or if -- a homograph is present, let Enter_Name handle it, either with an -- error or with the removal of an overridden implicit subprogram. + -- The previous one is a full declaration if it has an expression + -- (which in the case of an aggregate is indicated by the Init flag). if Ekind (Prev) /= E_Constant or else Nkind (Parent (Prev)) = N_Object_Renaming_Declaration or else Present (Expression (Parent (Prev))) + or else Has_Init_Expression (Parent (Prev)) or else Present (Full_View (Prev)) then Enter_Name (Id); diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index a5be290..1d64709 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2457,9 +2457,11 @@ package body Sem_Ch5 is -- Check for null or possibly null range and issue warning. We suppress -- such messages in generic templates and instances, because in practice - -- they tend to be dubious in these cases. + -- they tend to be dubious in these cases. The check applies as well to + -- rewritten array element loops where a null range may be detected + -- statically. - if Nkind (DS) = N_Range and then Comes_From_Source (N) then + if Nkind (DS) = N_Range then declare L : constant Node_Id := Low_Bound (DS); H : constant Node_Id := High_Bound (DS); @@ -2481,21 +2483,23 @@ package body Sem_Ch5 is if Compile_Time_Compare (L, H, Assume_Valid => False) = GT then - Error_Msg_N - ("??loop range is null, loop will not execute", DS); - -- Since we know the range of the loop is null, set the -- appropriate flag to remove the loop entirely during -- expansion. Set_Is_Null_Loop (Loop_Nod); - -- Here is where the loop could execute because of invalid - -- values, so issue appropriate message and in this case we - -- do not set the Is_Null_Loop flag since the loop may - -- execute. + if Comes_From_Source (N) then + Error_Msg_N + ("??loop range is null, loop will not execute", DS); + end if; - else + -- Here is where the loop could execute because of + -- invalid values, so issue appropriate message and in + -- this case we do not set the Is_Null_Loop flag since + -- the loop may execute. + + elsif Comes_From_Source (N) then Error_Msg_N ("??loop range may be null, loop may not execute", DS); diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index cc11f4f..f71fdd0 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -516,12 +516,12 @@ package Sinfo is -- expansion is performed and the analysis must generate a tree in a -- form that meets additional requirements. - -- This light expansion does two transformations of the tree, that cannot - -- be postponed after the frontend semantic analysis: + -- This light expansion does two transformations of the tree that cannot + -- be postponed after semantic analysis: -- 1. Replace object renamings by renamed object. This requires the - -- introdtion of temporaries at the point of the renaming, which must - -- be properly analyzed. + -- introduction of temporaries at the point of the renaming, which + -- must be properly analyzed. -- 2. Fully qualify entity names. This is needed to generate suitable -- local effects and call-graphs in ALI files, with the completely @@ -549,6 +549,39 @@ package Sinfo is -- not make sense from a user point-of-view, and that cross-references that -- do not lead to data dependences for subprograms can be safely ignored. + ----------------------- + -- Check Flag Fields -- + ----------------------- + + -- The following flag fields appear in expression nodes: + + -- Do_Division_Check + -- Do_Overflow_Check + -- Do_Range_Check + + -- These three flags are always set by the front end during semantic + -- analysis, on expression nodes that may trigger the corresponding + -- check. The front end then inserts or not the check during expansion. + -- In particular, these flags should also be correctly set in ASIS mode + -- and GNATprove mode. + + -- Note that this accounts for all nodes that trigger the corresponding + -- checks, except for range checks on subtype_indications, which may be + -- required to check that a range_constraint is compatible with the given + -- subtype (RM 3.2.2(11)). + + -- The following flag fields appear in various nodes: + + -- Do_Accessibility_Check + -- Do_Discriminant_Check + -- Do_Length_Check + -- Do_Storage_Check + -- Do_Tag_Check + + -- These flags are used in some specific cases by the front end, either + -- during semantic analysis or during expansion, and cannot be expected + -- to be set on all nodes that trigger the corresponding check. + ------------------------ -- Common Flag Fields -- ------------------------ @@ -2430,12 +2463,14 @@ package Sinfo is -- Etype (Node5-Sem) -- Must_Not_Freeze (Flag8-Sem) - -- Note: Etype is a copy of the Etype field of the Subtype_Mark. The - -- reason for this redundancy is so that in a list of array index types, - -- the Etype can be uniformly accessed to determine the subscript type. - -- This means that no Itype is constructed for the actual subtype that - -- is created by the subtype indication. If such an Itype is required, - -- it is constructed in the context in which the indication appears. + -- Note: Depending on context, the Etype is either the entity of the + -- Subtype_Mark field, or it is an itype constructed to reify the + -- subtype indication. In particular, such itypes are created for a + -- subtype indication that appears in an array type declaration. This + -- simplifies constraint checking in indexed components. + + -- For subtype indications that appear in scalar type and subtype + -- declarations, the Etype is the entity of the subtype mark. ------------------------- -- 3.2.2 Subtype Mark -- @@ -7325,7 +7360,7 @@ package Sinfo is -- N_Expression_With_Actions has type Standard_Void_Type. However some -- backends do not support such expression-with-actions occurring -- outside of a proper (non-void) expression, so this should just be - -- used as an intermediate representation within the front-end. Also + -- used as an intermediate representation within the front end. Also -- note that this is really an irregularity (expressions and statements -- are not interchangeable, and in particular an N_Null_Statement is -- not a proper expression), and in the long term all cases of this @@ -7746,7 +7781,7 @@ package Sinfo is -- e.g. involving unconstrained array types. -- For the case of the standard gigi backend, this means that all - -- checks are done in the front-end. + -- checks are done in the front end. -- However, in the case of specialized back-ends, notably the JVM -- backend for JGNAT, additional requirements and restrictions apply |