https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99122

--- Comment #35 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> interestingly I see
> 
>   a.9_70 = .builtin_alloca_with_align (iftmp.8_1, 8);
>   (*a.9_70) = inline22.get_zero (); [static-chain: &FRAME.20] [return slot
> optimization]
> 
> so there's no WITH_SIZE_EXPR, but the return value ends up done by reference:
> 
>         leaq    -80(%rbp), %rdx
>         movq    %rdx, %r10
>         movq    %rax, %rdi
>         call    inline22__get_zero.0
>         movq    %rbx, %rsp
>         movq    -8(%rbp), %rbx
>         leave
> 
> so I wonder if omitting DECL_BY_REFERENCE is simply a bug?  I mean the
> ABI of the callee must be aware and it seems CALL_EXPR_RETURN_SLOT_OPT
> is set by gimplification.  IIRC CALL_EXPR_RETURN_SLOT_OPT also only means
> we _may_ return by reference not that we must.

I don't think it's a bug, in the sense that you can be aggregate_value_p
without being DECL_BY_REFERENCE, as it's the case here; the latter is explicit
in the GIMPLE representation whereas the former is not.

> But of course if we do not exercise the return slot opt then there definitely
> is a WITH_SIZE_EXPR missing.  Unless I'm missing somehting ...

WITH_SIZE_EXPR is for something else (self-referential types).

> so I wonder if you can modify the Ada testcase so that
> CALL_EXPR_RETURN_SLOT_OPT is not set?

No, CALL_EXPR_RETURN_SLOT_OPT is always set, that's the point.

Reply via email to