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 <botca...@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 > > -- Gcc-rust mailing list Gcc-rust@gcc.gnu.org https://gcc.gnu.org/mailman/listinfo/gcc-rust