From: Eric Botcazou Date: Tue, 10 Nov 2015 00:45:03 +0000 (+0000) Subject: re PR target/57845 (ICE with -freg-struct-return on SPARC) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fbae25c0084e592c1e97fc0c8cf1650772d8c93a;p=gcc.git re PR target/57845 (ICE with -freg-struct-return on SPARC) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf785384ec8..32c31559f7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,15 @@ +2015-11-09 Eric Botcazou + + 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 * 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 +2015-11-09 Michael Meissner * config/rs6000/constraints.md (wF constraint): New constraints for power9/toc fusion. diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 7fa702e7d86..23f112583c2 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2875f15734f..88e1f522d8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,10 @@ -2015-11-08 Michael Meissner +2015-11-09 Eric Botcazou + + * 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 * lib/target-supports.exp (check_p8vector_hw_available): Split long line. diff --git a/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c b/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c new file mode 100644 index 00000000000..808e8a98f0e --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-skip-if "no register windows" { *-*-* } { "-mflat" } { "" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-mcpu=ultrasparc -O" } */ + +/* Make sure that Ultrasparc return insn do not read below the stack. */ + +void toto (int *); + +int bar (int a, int b, int c, int d, int e, int f, int g, int h) +{ + int res; + + toto (&res); + return h; +} +/* { dg-final { scan-assembler "return\[ \t\]*%i7\\+8\n\[^\n\]*ld\[ \t\]*\\\[%sp\\+96\\\]" } } */ + +int bar2 () +{ + int res; + + toto (&res); + return res; +} +/* { dg-final { scan-assembler "return\[ \t\]*%i7\\+8\n\[^\n\]*nop" } } */ 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 index 00000000000..536b9b75a4c --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/sparc-ret-2.c @@ -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; +} diff --git a/gcc/testsuite/gcc.target/sparc/sparc-ret.c b/gcc/testsuite/gcc.target/sparc/sparc-ret.c deleted file mode 100644 index 808e8a98f0e..00000000000 --- a/gcc/testsuite/gcc.target/sparc/sparc-ret.c +++ /dev/null @@ -1,26 +0,0 @@ -/* { dg-do compile } */ -/* { dg-skip-if "no register windows" { *-*-* } { "-mflat" } { "" } } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-options "-mcpu=ultrasparc -O" } */ - -/* Make sure that Ultrasparc return insn do not read below the stack. */ - -void toto (int *); - -int bar (int a, int b, int c, int d, int e, int f, int g, int h) -{ - int res; - - toto (&res); - return h; -} -/* { dg-final { scan-assembler "return\[ \t\]*%i7\\+8\n\[^\n\]*ld\[ \t\]*\\\[%sp\\+96\\\]" } } */ - -int bar2 () -{ - int res; - - toto (&res); - return res; -} -/* { dg-final { scan-assembler "return\[ \t\]*%i7\\+8\n\[^\n\]*nop" } } */