Second patch for HP-UX IA64 bootstrap failure
Richard Henderson
rth@redhat.com
Fri Sep 10 23:49:00 GMT 2004
On Fri, Sep 10, 2004 at 03:30:03PM -0700, Steve Ellcey wrote:
> After calling expand_expr_addr_expr_1 from expand_expr_addr_expr, tmode
> was VOIDmode but then it got set to BLKmode ...
Argh. I forgot the ADDR_EXPR had already been stripped.
Irritating that it worked with the first test case... ;-)
> Should tmode just be set to ptr_mode?
No, s390 has both 32 and 64 bit pointers simultaneously.
The user can select via __attribute__((mode("..."))).
One more try.
r~
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.718
diff -c -p -d -u -r1.718 expr.c
--- expr.c 8 Sep 2004 08:05:14 -0000 1.718
+++ expr.c 10 Sep 2004 22:45:52 -0000
@@ -6048,12 +6048,12 @@ expand_operands (tree exp0, tree exp1, r
}
-/* A subroutine of expand_expr. Evaluate the address of EXP.
+/* A subroutine of expand_expr_addr_expr. Evaluate the address of EXP.
The TARGET, TMODE and MODIFIER arguments are as for expand_expr. */
static rtx
-expand_expr_addr_expr (tree exp, rtx target, enum machine_mode tmode,
- enum expand_modifier modifier)
+expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
+ enum expand_modifier modifier)
{
rtx result, subtarget;
tree inner, offset;
@@ -6080,7 +6080,7 @@ expand_expr_addr_expr (tree exp, rtx tar
case CONST_DECL:
/* Recurse and make the output_constant_def clause above handle this. */
- return expand_expr_addr_expr (DECL_INITIAL (exp), target,
+ return expand_expr_addr_expr_1 (DECL_INITIAL (exp), target,
tmode, modifier);
case REALPART_EXPR:
@@ -6140,7 +6140,7 @@ expand_expr_addr_expr (tree exp, rtx tar
gcc_assert (inner != exp);
subtarget = offset || bitpos ? NULL_RTX : target;
- result = expand_expr_addr_expr (inner, subtarget, tmode, modifier);
+ result = expand_expr_addr_expr_1 (inner, subtarget, tmode, modifier);
if (tmode == VOIDmode)
{
@@ -6181,6 +6181,33 @@ expand_expr_addr_expr (tree exp, rtx tar
return result;
}
+/* A subroutine of expand_expr. Evaluate EXP, which is an ADDR_EXPR.
+ The TARGET, TMODE and MODIFIER arguments are as for expand_expr. */
+
+static rtx
+expand_expr_addr_expr (tree exp, rtx target, enum machine_mode tmode,
+ enum expand_modifier modifier)
+{
+ enum machine_mode rmode;
+ rtx result;
+
+ result = expand_expr_addr_expr_1 (TREE_OPERAND (exp, 0), target,
+ tmode, modifier);
+
+ /* Despite expand_expr claims concerning ignoring TMODE when not
+ strictly convenient, stuff breaks if we don't honor it. */
+ if (tmode == VOIDmode)
+ tmode = TYPE_MODE (TREE_TYPE (exp));
+ rmode = GET_MODE (result);
+ if (rmode == VOIDmode)
+ rmode = tmode;
+ if (rmode != tmode)
+ result = convert_memory_address (tmode, result);
+
+ return result;
+}
+
+
/* expand_expr: generate code for computing expression EXP.
An rtx for the computed value is returned. The value is never null.
In the case of a void EXP, const0_rtx is returned.
@@ -8064,8 +8091,7 @@ expand_expr_real_1 (tree exp, rtx target
return const0_rtx;
case ADDR_EXPR:
- return expand_expr_addr_expr (TREE_OPERAND (exp, 0), target,
- tmode, modifier);
+ return expand_expr_addr_expr (exp, target, tmode, modifier);
/* COMPLEX type for Extended Pascal & Fortran */
case COMPLEX_EXPR:
More information about the Gcc-patches
mailing list