From 5806d4fd849871d77fdc9b5f6a1ef05d42039a52 Mon Sep 17 00:00:00 2001 From: James E Wilson Date: Fri, 9 Jul 2004 23:10:26 +0000 Subject: [PATCH] Fix for IA-64 union/long double ICE. PR target/16364 * config/ia64/ia64.c (ia64_function_arg): For a single element HFA, do return a parallel if hfa_mode == XFmode and mode == TImode. * gcc.c-torture/compile/20040709-1.c: New. From-SVN: r84416 --- gcc/ChangeLog | 6 ++++++ gcc/config/ia64/ia64.c | 8 ++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/20040709-1.c | 10 ++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20040709-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0bb7353eeab..3c59958f24d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-09 James E Wilson + + PR target/16364 + * config/ia64/ia64.c (ia64_function_arg): For a single element HFA, + do return a parallel if hfa_mode == XFmode and mode == TImode. + 2004-07-09 Jan Beulich * builtin-types.def (BT_UINT): Rename from BT_UNSIGNED. diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 117f965e29e..fdebfba19cd 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -3746,8 +3746,12 @@ ia64_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type, } /* If we ended up using just one location, just return that one loc, but - change the mode back to the argument mode. */ - if (i == 1) + change the mode back to the argument mode. However, we can't do this + when hfa_mode is XFmode and mode is TImode. In that case, we would + return a TImode reference to an FP reg, but FP regs can't hold TImode. + We need the PARALLEL to make this work. This can happen for a union + containing a single __float80 member. */ + if (i == 1 && ! (hfa_mode == XFmode && mode == TImode)) return gen_rtx_REG (mode, REGNO (XEXP (loc[0], 0))); else return gen_rtx_PARALLEL (mode, gen_rtvec_v (i, loc)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89d0e6d3a31..d82a14fd844 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-07-09 James E Wilson + + PR target/16364 + * gcc.c-torture/compile/20040709-1.c: New. + 2004-07-09 Tobias Schlueter PR fortran/14077 diff --git a/gcc/testsuite/gcc.c-torture/compile/20040709-1.c b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c new file mode 100644 index 00000000000..c8c9cc357fb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20040709-1.c @@ -0,0 +1,10 @@ +/* PR target/16364 */ +union foo { + long double ld; +} bar; + +double +sub (union foo baz) +{ + return baz.ld / 2; +} -- 2.30.2