This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] improve C++ code by changing fold-const.c
- From: Roger Sayle <roger at eyesopen dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 May 2004 20:06:46 -0600 (MDT)
- Subject: Re: [PATCH] improve C++ code by changing fold-const.c
On Sun, 16 May 2004, Andrew Pinski wrote:
> I found that my cast pass was too complicated and replicated too much in
> which was in fold already. The only thing fold did not handle that my
> cast pass did was changing the type of an ADDR_EXPR.
Could you explain a bit more about why this is needed? At the moment,
I believe that it's always the case that the type of an ADDR_EXPR node
is a pointer type to the type of it's operand. Your patch changes this
to make ADDR_EXPR a form of conversion operator.
Which parts of tree-ssa have problems with "NOP_EXPR (type, ADDR_EXPR
...)" that they don't have with just ADDR_EXPR and a mismatched type?
I've read through both PR14032 and PR14720 and whilst they motivate
why this is a serious problem, they provide no indication of why
treating ADDR_EXPR as a conversion operator is a suitable fix. I'm
not convinced that this isn't just papering over a missing STRIP_NOPS.
For example, would it be reasonable to instead fold this as:
NOP_EXPR (T1, ADDR_EXPR (T2, X)) =>
ADDR_EXPR (T1, NOP_EXPR (T3, X))
i.e. push the conversion operation inside the ADDR_EXPR. Where T1
and T2 are pointer types to compatible types T3 and T4 respectively
and X has type T4.