Fix ICE on unaligned assignment of return value

Message ID 1405893385.byzAuQ9idW@polaris
State New
Headers show

Commit Message

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

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

2014-07-20  Eric Botcazou  <>

	* gnat.dg/[sb]: New test.
	* gnat.dg/ New helper.


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