This is a regression present on mainline and 4.9 branch and visible e.g. on
SPARC64: the code dealing with values returned in PARALLEL fails to handle the
case of an unaligned target if the mode is an integral mode and not BLKmode.
Tested on SPARC64/Solaris and x86-64/Linux, applied on mainline and 4.9 branch
as obvious.
2014-07-20 Eric Botcazou <ebotca...@adacore.com>
* expr.c (store_field): Handle VOIDmode for calls that return values
in multiple locations.
2014-07-20 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/pack20.ad[sb]: New test.
* gnat.dg/pack20_pkg.ads: New helper.
--
Eric Botcazou
Index: expr.c
===================================================================
--- expr.c (revision 212833)
+++ expr.c (working copy)
@@ -6581,7 +6581,7 @@ store_field (rtx target, HOST_WIDE_INT b
{
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
rtx temp_target;
- if (mode == BLKmode)
+ if (mode == BLKmode || mode == VOIDmode)
mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
temp_target = gen_reg_rtx (mode);
emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
package body Pack20 is
procedure Proc (A : Rec) is
Local : Rec := A;
begin
Modify (Local.Fixed);
end;
end Pack20;
-- { dg-do compile }
with Pack20_Pkg; use Pack20_Pkg;
package Pack20 is
type Rec is record
Simple_Type : Integer;
Fixed : String_Ptr;
end record;
pragma Pack (Rec);
procedure Proc (A : Rec);
end Pack20;
package Pack20_Pkg is
type String_Ptr is access all String;
procedure Modify (Fixed : in out String_Ptr);
end Pack20_Pkg;