This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [preliminary patch] fold-const.c: Fix PR 23960.
- From: Roger Sayle <roger at eyesopen dot com>
- To: Kazu Hirata <kazu at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 24 Sep 2005 19:38:44 -0600 (MDT)
- Subject: Re: [preliminary patch] fold-const.c: Fix PR 23960.
On Sat, 24 Sep 2005, Kazu Hirata wrote:
> 2005-09-24 Kazu Hirata <kazu@codesourcery.com>
>
> * fold-const.c (fold_binary): Use op0 and op1 instead of arg0
> and arg1 if we are passing them to fold_build2.
>
> 2005-09-24 Kazu Hirata <kazu@codesourcery.com>
>
> * gcc.c-torture/compile/pr23960.c: New.
This is OK for mainline. Thanks.
> IIRC, Roger Sayle prefers fold_convert (TREE_TYPE (op0), arg0) to op0.
> I sort of prefer op0 because we fold trees as we build them, so if we
> use fold_convert, chances are we are constructing the same NOP_EXPR or
> CONVERT_EXPR that we have just stripped at the beginning
> fold_{unary,binary,ternary}. Anyway, I am not feeling strongly about
> this.
I'll admit that I don't feel too strongly about this myself either.
The obvious motivation for my pseudo-preference for sometimes calling
convert_expr, is to handle the case when operands haven't been folded
(i.e. that contain more than one NOP_EXPR, or incorrectly use NOP_EXPR
vs. CONVERT_EXPR). Although there are still PRs for not fully folding
trees, type safety in the middle-end is much better than it used to be.
In the current climate, I actually prefer your approach for binary
operators, but might still consider fold_convert for unary operators.
Thanks again,
Roger
--