+2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_attr.adb (Expand_Loop_Entry_Attribute): Copy the condition
+ of a while loop instead of simply relocating it.
+
2019-07-18 Arnaud Charlet <charlet@adacore.com>
* Makefile.rtl, expect.c, env.c, aux-io.c, mkdir.c, initialize.c,
Stmts : List_Id;
begin
+ Func_Id := Make_Temporary (Loc, 'F');
+
-- Wrap the condition of the while loop in a Boolean function.
-- This avoids the duplication of the same code which may lead
-- to gigi issues with respect to multiple declaration of the
Append_To (Stmts,
Make_Simple_Return_Statement (Loc,
- Expression => Relocate_Node (Condition (Scheme))));
+ Expression =>
+ New_Copy_Tree (Condition (Scheme),
+ New_Scope => Func_Id)));
-- Generate:
-- function Fnn return Boolean is
-- <Stmts>
-- end Fnn;
- Func_Id := Make_Temporary (Loc, 'F');
Func_Decl :=
Make_Subprogram_Body (Loc,
Specification =>
+2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/loop_invariant1.adb, gnat.dg/loop_invariant1.ads: New
+ testcase.
+
2019-07-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/91221
--- /dev/null
+-- { dg-do compile }
+-- { dg-options "-gnata" }
+
+package body Loop_Invariant1 is
+
+ procedure Proc (A : Arr; N : Integer) is
+ I : Integer := A'First;
+ begin
+ while i <= A'Last and then A(A'First .. A'Last) /= A loop
+ pragma Loop_Invariant (N = N'Loop_Entry);
+ i := i + 1;
+ end loop;
+ end;
+
+end Loop_Invariant1;
--- /dev/null
+package Loop_Invariant1 is
+
+ type Arr is array (Natural range <>) of Integer;
+
+ procedure Proc (A : Arr; N : Integer);
+
+end Loop_Invariant1;