On Fri, May 13, 2022 at 9:57 AM Eric Botcazou via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi, > > most cases of VIEW_CONVERT_EXPRs involving reverse scalar storage order are > disqualified for SRA because they are storage_order_barrier_p, but you can > still have a VIEW_CONVERT_EXPR to a regular composite type being applied to > a component of a record type with reverse scalar storage order, although this > is pretty rare even in Ada (the only idiomatic way I know of is to use 'Valid > on a floating-point component). > > In this case, the bypass for !useless_type_conversion_p in sra_modify_assign, > albeit already heavily guarded, triggers and may generate wrong code, e.g. on > the attached testcase, so the patch makes sure that it does only when the SSO > is the same on both side. > > Bootstrapped/regtested on x86-64/Linux, OK for the mainline?
OK. Possibly also qualifies for the branch(es) as wrong-code fix. Thanks, Richard. > > 2022-05-13 Eric Botcazou <ebotca...@adacore.com> > > * tree-sra.c (sra_modify_assign): Check that the scalar storage order > is the same on the LHS and RHS before rewriting one with the model of > the other. > > > 2022-05-13 Eric Botcazou <ebotca...@adacore.com> > > * gnat.dg/sso17.adb: New test. > > -- > Eric Botcazou