This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix remaining ia64 compat failures
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Dec 2004 12:52:12 -0800
- Subject: fix remaining ia64 compat failures
Sometimes I really really hate gcc extensions. The remaining
failures are passing structures of the form
struct S { float f[0]; };
That is, a zero sized structure containing a zero-sized member
that would otherwise cause the structure to be considered an
homogenous floating-point aggregate.
The immediate problem is that we'd create a PARALLEL for this
with no elements. I considered several alternatives for fixing
this, but the most straight-forward seems to be to just not
consider such a beast for HFA processing.
Fixes
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_x_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_y_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t028 c_compat_x_tst.o compile
FAIL: tmpdir-gcc.dg-struct-layout-1/t028 c_compat_y_tst.o compile
r~
* config/ia64/ia64.c (hfa_element_mode): Return false for
zero-sized top-level aggregates.
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.337
diff -c -p -d -r1.337 ia64.c
*** config/ia64/ia64.c 30 Dec 2004 08:59:15 -0000 1.337
--- config/ia64/ia64.c 30 Dec 2004 20:41:19 -0000
*************** static rtx gen_movdi_x (rtx, rtx, rtx);
*** 186,192 ****
static rtx gen_fr_spill_x (rtx, rtx, rtx);
static rtx gen_fr_restore_x (rtx, rtx, rtx);
! static enum machine_mode hfa_element_mode (tree, int);
static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool ia64_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
--- 186,192 ----
static rtx gen_fr_spill_x (rtx, rtx, rtx);
static rtx gen_fr_restore_x (rtx, rtx, rtx);
! static enum machine_mode hfa_element_mode (tree, bool);
static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool ia64_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
*************** ia64_setup_incoming_varargs (CUMULATIVE_
*** 2968,2977 ****
An aggregate is a homogeneous floating point aggregate is if all
fields/elements in it have the same floating point type (e.g,
! SFmode). 128-bit quad-precision floats are excluded. */
static enum machine_mode
! hfa_element_mode (tree type, int nested)
{
enum machine_mode element_mode = VOIDmode;
enum machine_mode mode;
--- 2968,2981 ----
An aggregate is a homogeneous floating point aggregate is if all
fields/elements in it have the same floating point type (e.g,
! SFmode). 128-bit quad-precision floats are excluded.
!
! Variable sized aggregates should never arrive here, since we should
! have already decided to pass them by reference. Top-level zero-sized
! aggregates are excluded because our parallels crash the middle-end. */
static enum machine_mode
! hfa_element_mode (tree type, bool nested)
{
enum machine_mode element_mode = VOIDmode;
enum machine_mode mode;
*************** hfa_element_mode (tree type, int nested)
*** 2979,2984 ****
--- 2983,2991 ----
int know_element_mode = 0;
tree t;
+ if (!nested && (!TYPE_SIZE (type) || integer_zerop (TYPE_SIZE (type))))
+ return VOIDmode;
+
switch (code)
{
case VOID_TYPE: case INTEGER_TYPE: case ENUMERAL_TYPE: