From fbae25c0084e592c1e97fc0c8cf1650772d8c93a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 10 Nov 2015 00:45:03 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 8 +++++++- gcc/config/sparc/sparc.c | 5 +++-- gcc/testsuite/ChangeLog | 8 +++++++- .../gcc.target/sparc/{sparc-ret.c => sparc-ret-1.c} | 0 gcc/testsuite/gcc.target/sparc/sparc-ret-2.c | 13 +++++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) rename gcc/testsuite/gcc.target/sparc/{sparc-ret.c => sparc-ret-1.c} (100%) create mode 100644 gcc/testsuite/gcc.target/sparc/sparc-ret-2.c 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.c b/gcc/testsuite/gcc.target/sparc/sparc-ret-1.c similarity index 100% rename from gcc/testsuite/gcc.target/sparc/sparc-ret.c rename to gcc/testsuite/gcc.target/sparc/sparc-ret-1.c 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; +} -- 2.30.2