public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SPARC] Fix PR target/57845
@ 2015-11-10  0:49 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2015-11-10  0:49 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

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.

-- 
Eric Botcazou

[-- Attachment #2: pr57845.diff --]
[-- Type: text/x-patch, Size: 717 bytes --]

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;

[-- Attachment #3: sparc-ret-2.c --]
[-- Type: text/x-csrc, Size: 187 bytes --]

/* PR target/57845 */

/* { dg-do compile } */
/* { dg-options "-freg-struct-return" } */

struct S { short int i; };

struct S foo (short int i)
{
  struct S s;
  s.i = i;
  return s;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-10  0:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  0:49 [SPARC] Fix PR target/57845 Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).