qual_union_type help
Philip Herron
philip.herron@embecosm.com
Wed Feb 23 17:44:59 GMT 2022
Hi Eric,
That makes sense during construction we also know what the value of
the discriminant is. What does the Ada front-end replace the
placeholder_exprs with? Can it simply be the value of the discriminant
at constructor? I haven't tried that.
Thanks
--Phil
On Wed, 23 Feb 2022 at 17:33, Eric Botcazou <botcazou@adacore.com> wrote:
>
> > This makes sense this we can't gimplify a placeholder expression. So
> > this seems that when i make a constructor for the QUAL_UNION_TYPE i
> > must iterate the fields and replace the placeholder_expr to have a
> > reference to the discriminant via another COMPONENT_REF. Though does
> > this mean for the constructor i will need to create a temporary to
> > hold onto it to create another component_ref?
>
> The Ada compiler gets rid of all PLACEHOLDER_EXPRs in CONSTRUCTORs because the
> subtype of these CONSTRUCTORs is always constrained in Ada parlance, i.e. you
> know the value of the discriminant since it is assigned in the CONSTRUCTOR, so
> the gimplifier is indeed presumably not wired to eliminate them on its own.
>
> --
> Eric Botcazou
>
>
More information about the Gcc-rust
mailing list