diff mbox

[SPARC] Fix PR target/57845

Message ID 3023197.FrU39L0Kvz@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 10, 2015, 12:49 a.m. UTC
This PR is about an ICE on SPARC 32-bit with -freg-struct-return.  I didn't 
know that this option was supported on this architecture but apparently it 
was, at least in the 3.x series, so the attached patchlet fixes the ICE.

Tested on SPARC/Solaris (including compat testing), applied on all branches.


2015-11-09  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/57845
	* config/sparc/sparc.c (sparc_function_value_1): In 32-bit mode, do
	not promote the mode for aggregate types.


2015-11-09  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.target/sparc/sparc-ret.c: Rename to...
	* gcc.target/sparc/sparc-ret-1.c: ...this.
	* gcc.target/sparc/sparc-ret-2.c: New test.
diff mbox

Patch

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 230016)
+++ config/sparc/sparc.c	(working copy)
@@ -7329,9 +7329,10 @@  sparc_function_value_1 (const_tree type,
 	mode = word_mode;
     }
 
-  /* We should only have pointer and integer types at this point.  This must
-     match sparc_promote_function_mode.  */
+  /* We should only have pointer and integer types at this point, except with
+     -freg-struct-return.  This must match sparc_promote_function_mode.  */
   else if (TARGET_ARCH32
+	   && !(type && AGGREGATE_TYPE_P (type))
 	   && mclass == MODE_INT
 	   && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
     mode = word_mode;