On 09/08/2024 17:08, Jakub Jelinek wrote:
> On Fri, Aug 09, 2024 at 11:01:22AM -0400, Jason Merrill wrote:
> > > The CLEANUP_POINT_EXPR gets added by the following call chain:
> > > 
> > > finish_while_stmt_cond
> > >   -> maybe_convert_cond
> > >   -> condition_conversion
> > >   -> fold_build_cleanup_point_expr
> > > 
> > > this patch chooses to fix the issue in maybe_convert_cond by walking 
> > > through
> > > any ANNOTATE_EXPRs and doing any condition conversion on the inner 
> > > expression,
> > > leaving the ANNOTATE_EXPRs (if any) as the outermost expressions in the
> > > condition.
> > 
> > I see that simplify_loop_decl_cond and finish_loop_cond use this same
> > pattern.  OK.
> 
> I'm a little bit worried about the convert_from_reference in there.
> Shouldn't TREE_TYPE of ANNOTATE_EXPR always match the TREE_TYPE of its
> operand?  If it could be say REFERENCE_TYPE to BOOLEAN_TYPE,
> convert_from_reference could change it but with the patch fail to adjust
> the type.

Hmm, good spot, I didn't realise that convert_from_reference could
change the type of the condition like this.

In that case I suppose the only thing to do is to construct a stack of
ANNOTATE_EXPRs on the way down and re-build the expressions (taking the
type of the inner expression, starting with the cond) on the way back
up.

I'll try something along those lines, then (unless there are further
comments suggesting otherwise!)

Thanks,
Alex

> 
>       Jakub
> 

Reply via email to