Skip to content

Commit 95fc803

Browse files
author
charlet
committed
2017-05-02 Bob Duff <duff@adacore.com>
* sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep. 2017-05-02 Vasiliy Fofanov <fofanov@adacore.com> * s-os_lib.ads: Minor typo fix. 2017-05-02 Vasiliy Fofanov <fofanov@adacore.com> * gnatls.adb: Merge and refactor code from Prj.Env and remove this deprecated dependency. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_util.ads: minor comment addition. 2017-05-02 Eric Botcazou <ebotcazou@adacore.com> * sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and pastos in part #3 of the head comment. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_ch3.adb (Freeze_Type): Do not generate an invariant procedure body for a local (sub)type declaration within a predicate function. Invariant checks do not apply to these, and the expansion of the procedure will happen in the wrong scope, leading to misplaced freeze nodes. 2017-05-02 Ed Schonberg <schonberg@adacore.com> * exp_util.adb (Insert_Library_Level_Action): Use proper scope to analyze generated actions. If the main unit is a body, the required scope is that of the corresponding unit declaration. 2017-05-02 Arnaud Charlet <charlet@adacore.com> * einfo.adb (Declaration_Node): flip branches of an IF statement to avoid repeated negations in its condition; no change in semantics, only to improve readability. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247480 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 166dae9 commit 95fc803

File tree

9 files changed

+556
-46
lines changed

9 files changed

+556
-46
lines changed

gcc/ada/ChangeLog

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
2017-05-02 Bob Duff <duff@adacore.com>
2+
3+
* sem_attr.adb (Attribute_Enum_Rep): Disallow T'Enum_Rep.
4+
5+
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
6+
7+
* s-os_lib.ads: Minor typo fix.
8+
9+
2017-05-02 Vasiliy Fofanov <fofanov@adacore.com>
10+
11+
* gnatls.adb: Merge and refactor code from Prj.Env and remove
12+
this deprecated dependency.
13+
14+
2017-05-02 Ed Schonberg <schonberg@adacore.com>
15+
16+
* exp_util.ads: minor comment addition.
17+
18+
2017-05-02 Eric Botcazou <ebotcazou@adacore.com>
19+
20+
* sem_ch3.adb (Build_Derived_Record_Type): Fix a few typos and
21+
pastos in part #3 of the head comment.
22+
23+
2017-05-02 Ed Schonberg <schonberg@adacore.com>
24+
25+
* exp_ch3.adb (Freeze_Type): Do not generate an invariant
26+
procedure body for a local (sub)type declaration within a
27+
predicate function. Invariant checks do not apply to these, and
28+
the expansion of the procedure will happen in the wrong scope,
29+
leading to misplaced freeze nodes.
30+
31+
2017-05-02 Ed Schonberg <schonberg@adacore.com>
32+
33+
* exp_util.adb (Insert_Library_Level_Action): Use proper scope
34+
to analyze generated actions. If the main unit is a body,
35+
the required scope is that of the corresponding unit declaration.
36+
37+
2017-05-02 Arnaud Charlet <charlet@adacore.com>
38+
39+
* einfo.adb (Declaration_Node): flip branches of
40+
an IF statement to avoid repeated negations in its condition;
41+
no change in semantics, only to improve readability.
42+
143
2017-05-02 Arnaud Charlet <charlet@adacore.com>
244

345
* sem_case.adb: Remove extra spaces in parameter declarations.

gcc/ada/einfo.adb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7117,15 +7117,13 @@ package body Einfo is
71177117
end if;
71187118

71197119
loop
7120-
if Nkind (P) /= N_Selected_Component
7121-
and then Nkind (P) /= N_Expanded_Name
7122-
and then
7123-
not (Nkind (P) = N_Defining_Program_Unit_Name
7124-
and then Is_Child_Unit (Id))
7120+
if Nkind_In (P, N_Selected_Component, N_Expanded_Name)
7121+
or else (Nkind (P) = N_Defining_Program_Unit_Name
7122+
and then Is_Child_Unit (Id))
71257123
then
7126-
return P;
7127-
else
71287124
P := Parent (P);
7125+
else
7126+
return P;
71297127
end if;
71307128
end loop;
71317129
end Declaration_Node;

gcc/ada/exp_ch3.adb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7554,8 +7554,19 @@ package body Exp_Ch3 is
75547554

75557555
-- Non-interface types
75567556

7557+
-- Do not generate invariant procedure within other assertion
7558+
-- subprograms, which may involve local declarations of local
7559+
-- subtypes to which these checks don't apply.
7560+
75577561
elsif Has_Invariants (Def_Id) then
7558-
Build_Invariant_Procedure_Body (Def_Id);
7562+
if Within_Internal_Subprogram
7563+
or else (Ekind (Current_Scope) = E_Function
7564+
and then Is_Predicate_Function (Current_Scope))
7565+
then
7566+
null;
7567+
else
7568+
Build_Invariant_Procedure_Body (Def_Id);
7569+
end if;
75597570
end if;
75607571

75617572
Restore_Ghost_Mode (Saved_GM);

gcc/ada/exp_util.adb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7491,8 +7491,10 @@ package body Exp_Util is
74917491
Aux : constant Node_Id := Aux_Decls_Node (Cunit (Main_Unit));
74927492

74937493
begin
7494-
Push_Scope (Cunit_Entity (Main_Unit));
7495-
-- ??? should this be Current_Sem_Unit instead of Main_Unit?
7494+
Push_Scope (Cunit_Entity (Current_Sem_Unit));
7495+
-- And not Main_Unit as previously. If the main unit is a body,
7496+
-- the scope needed to analyze the actions is the entity of the
7497+
-- corresponding declaration.
74967498

74977499
if No (Actions (Aux)) then
74987500
Set_Actions (Aux, New_List (N));

gcc/ada/exp_util.ads

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,9 @@ package Exp_Util is
11771177
function Within_Internal_Subprogram return Boolean;
11781178
-- Indicates that some expansion is taking place within the body of a
11791179
-- predefined primitive operation. Some expansion activity (e.g. predicate
1180-
-- checks) is disabled in such.
1180+
-- checks) is disabled in such. Because we want to detect invalid uses
1181+
-- of function calls within predicates (which lead to infinite recursion)
1182+
-- predicate functions themselves are not considered internal here.
11811183

11821184
private
11831185
pragma Inline (Duplicate_Subexpr);

0 commit comments

Comments
 (0)