This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Solaris 9/Intel Ada bootstrap broken
- From: law at redhat dot com
- To: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 04 Jul 2003 16:04:59 -0600
- Subject: Re: Solaris 9/Intel Ada bootstrap broken
- Reply-to: law at redhat dot com
In message <16132.36390.174732.239700@xayide.TechFak.Uni-Bielefeld.DE>, Rainer
Orth writes:
>--Multipart_Thu_Jul__3_22:12:22_2003-1
>Content-Type: text/plain; charset=US-ASCII
>
>law@redhat.com writes:
>
>> Can you send me a .i file privately? I tried to bootstrap Ada as part
>> of my changes, but it failed so miserably in ways totally unrelated to
>> my patch that I gave up.
>
>Sure, included.
Thanks. This should fix the problem.
Basically do_store_flag receives a mode for the result of the operation. We
need to pass that down to the folder (as a type).
Roger Sayle also pointed out a potential bug in the folder itself -- it
ignored the passed-in result type when optimizing a sign bit test.
Fixed with this patch which I have checked into the mainline as well as
the tree-ssa branch:
* expr.c (do_store_flag): Pass in the correct result type
when calling fold_single_bit_test.
* fold-const.c (fold_single_bit_test): Use result_type for the
result when folding a sign bit test.
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.561
diff -c -3 -p -r1.561 expr.c
*** expr.c 3 Jul 2003 05:42:57 -0000 1.561
--- expr.c 4 Jul 2003 21:51:45 -0000
*************** do_store_flag (tree exp, rtx target, enu
*** 9998,10006 ****
if ((code == NE || code == EQ)
&& TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
&& integer_pow2p (TREE_OPERAND (arg0, 1)))
! return expand_expr (fold_single_bit_test (code == NE ? NE_EXPR : EQ_EXPR,
! arg0, arg1, type),
! target, VOIDmode, EXPAND_NORMAL);
/* Now see if we are likely to be able to do this. Return if not. */
if (! can_compare_p (code, operand_mode, ccp_store_flag))
--- 9998,10009 ----
if ((code == NE || code == EQ)
&& TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
&& integer_pow2p (TREE_OPERAND (arg0, 1)))
! {
! tree type = (*lang_hooks.types.type_for_mode) (mode, unsignedp);
! return expand_expr (fold_single_bit_test (code == NE ? NE_EXPR :
EQ_EXPR,
! arg0, arg1, type),
! target, VOIDmode, EXPAND_NORMAL);
! }
/* Now see if we are likely to be able to do this. Return if not. */
if (! can_compare_p (code, operand_mode, ccp_store_flag))
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.273
diff -c -3 -p -r1.273 fold-const.c
*** fold-const.c 3 Jul 2003 05:42:57 -0000 1.273
--- fold-const.c 4 Jul 2003 21:51:59 -0000
*************** fold_single_bit_test (code, arg0, arg1,
*** 4844,4850 ****
if (arg00 != NULL_TREE)
{
tree stype = (*lang_hooks.types.signed_type) (TREE_TYPE (arg00));
! return fold (build (code == EQ_EXPR ? GE_EXPR : LT_EXPR, type,
convert (stype, arg00),
convert (stype, integer_zero_node)));
}
--- 4844,4850 ----
if (arg00 != NULL_TREE)
{
tree stype = (*lang_hooks.types.signed_type) (TREE_TYPE (arg00));
! return fold (build (code == EQ_EXPR ? GE_EXPR : LT_EXPR, result_type,
convert (stype, arg00),
convert (stype, integer_zero_node)));
}