--- /dev/null
+package body Lto28_Pkg2 is
+
+ function F return Lto28_Pkg3.Q_Rec is
+ begin
+ return Result : Lto28_Pkg3.Q_Rec := Lto28_Pkg3.Default_Q_Rec do
+ Result.A := 1.0;
+ end return;
+ end;
+
+end Lto28_Pkg2;
--- /dev/null
+package Lto28_Pkg3 is
+
+ type Discr_Type is (P, Q);
+
+ type Rec (Discr : Discr_Type) is record
+ case Discr is
+ when Q =>
+ A : Duration := 0.0;
+ B : Duration := 0.0;
+ when P =>
+ null;
+ end case;
+ end record;
+
+ subtype Q_Rec is Rec (Q);
+
+ Default_Q_Rec : constant Q_Rec := (Discr => Q, others => <>);
+
+end Lto28_Pkg3;
if (DECL_P (modify_dest))
suppress_warning (modify_dest, OPT_Wuninitialized);
+ /* If we have a return slot, we can assign it the result directly,
+ except in the case where it is a global variable that is only
+ written to because, the callee being permitted to read or take
+ the address of its DECL_RESULT, this could invalidate the flag
+ on the global variable; instead we preventively remove the store,
+ which would have happened later if the call was not inlined. */
if (gimple_call_return_slot_opt_p (call_stmt))
{
- return_slot = modify_dest;
+ tree base = get_base_address (modify_dest);
+
+ if (VAR_P (base)
+ && (TREE_STATIC (base) || DECL_EXTERNAL (base))
+ && varpool_node::get (base)->writeonly)
+ return_slot = NULL;
+ else
+ return_slot = modify_dest;
+
modify_dest = NULL;
}
}