]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/57845 (ICE with -freg-struct-return on SPARC)
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 10 Nov 2015 00:45:03 +0000 (00:45 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 10 Nov 2015 00:45:03 +0000 (00:45 +0000)
PR target/57845
* config/sparc/sparc.c (sparc_function_value_1): In 32-bit mode, do
not promote the mode for aggregate types.

From-SVN: r230074

gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sparc/sparc-ret-1.c [moved from gcc/testsuite/gcc.target/sparc/sparc-ret.c with 100% similarity]
gcc/testsuite/gcc.target/sparc/sparc-ret-2.c [new file with mode: 0644]

index bf785384ec862b5466ba1b01f1b8db8633318bea..32c31559f7addc225354e3209effa8fd1b20b71d 100644 (file)
@@ -1,9 +1,15 @@
+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  Nathan Sidwell  <nathan@codesourcery.com>
 
        * omp-low.h (replace_oacc_fn_attrib, build_oacc_routine_dims): Declare.
        * omp-low.c (build_oacc_routine_dims): New.
 
-2015-11-08  Michael Meissner  <meissner@linux.vnet.ibm.com>
+2015-11-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/constraints.md (wF constraint): New constraints
        for power9/toc fusion.
index 7fa702e7d865ab20cb821ce1a6618e50ea776fc9..23f112583c279ff19b7b2f12c7722546f2a2dfc1 100644 (file)
@@ -7329,9 +7329,10 @@ sparc_function_value_1 (const_tree type, machine_mode mode,
        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;
index 2875f15734fe5813721d096148df68d8d28f347f..88e1f522d8a6d4af80de08521ad698f981ee0297 100644 (file)
@@ -1,4 +1,10 @@
-2015-11-08  Michael Meissner  <meissner@linux.vnet.ibm.com>
+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.
+
+2015-11-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * lib/target-supports.exp (check_p8vector_hw_available): Split
        long line.
diff --git a/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c b/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c
new file mode 100644 (file)
index 0000000..536b9b7
--- /dev/null
@@ -0,0 +1,13 @@
+/* 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;
+}