+2019-07-04 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch4.adb (Expand_Short_Circuit_Operator): Strip
+ N_Variable_Reference_Marker when checking for the presence of
+ actions.
+
2019-07-04 Arnaud Charlet <charlet@adacore.com>
* exp_aggr.adb (Check_Component): Take into account type
-- For Opnd a boolean expression, return a Boolean expression equivalent
-- to Opnd /= Shortcut_Value.
+ function Useful (Actions : List_Id) return Boolean;
+ -- Return True if Actions is not empty and contains useful nodes to
+ -- process.
+
--------------------
-- Make_Test_Expr --
--------------------
end if;
end Make_Test_Expr;
+ ------------
+ -- Useful --
+ ------------
+
+ function Useful (Actions : List_Id) return Boolean is
+ L : Node_Id;
+ begin
+ if Present (Actions) then
+ L := First (Actions);
+
+ -- For now "useful" means not N_Variable_Reference_Marker.
+ -- Consider stripping other nodes in the future.
+
+ while Present (L) loop
+ if Nkind (L) /= N_Variable_Reference_Marker then
+ return True;
+ end if;
+
+ Next (L);
+ end loop;
+ end if;
+
+ return False;
+ end Useful;
+
-- Local variables
Op_Var : Entity_Id;
-- must only be executed if the right operand of the short circuit is
-- executed and not otherwise.
- if Present (Actions (N)) then
+ if Useful (Actions (N)) then
Actlist := Actions (N);
-- The old approach is to expand: