Patchwork Fix ICE on unaligned assignment of return value

login
register
mail settings
Submitter Eric Botcazou
Date July 20, 2014, 8:43 p.m.
Message ID <1405893385.byzAuQ9idW@polaris>
Download mbox | patch
Permalink /patch/371941/
State New
Headers show

Comments

Eric Botcazou - July 20, 2014, 8:43 p.m.
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  <ebotcazou@adacore.com>

	* expr.c (store_field): Handle VOIDmode for calls that return values
	in multiple locations.


2014-07-20  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/pack20.ad[sb]: New test.
	* gnat.dg/pack20_pkg.ads: New helper.

Patch

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);