https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108199
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-12-22 Summary|Bitfields and |Bitfields, unions and SRA |storage_order_attribute |and storage_order_attribute Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andreas Krebbel from comment #2) > The problem appears to get introduced when dead store elimination removes > the assignment to the target struct in FRE. There is no DSE in FRE going on .... Rather SRA did messed up. > > Before FRE we have the following: > > _1 = src_6(D)->a; bswap > dst$val_9 = _1; bswap > _2 = BIT_FIELD_REF <dst$val_9, 8, 0>; bswap > _3 = _2 & 64; > if (_3 != 0) dst$val_9/_1 are both SSA names and not a store/load. so there is no swapping going on. It is definitely SRA going wrong. Turning off SRA (-fno-sra) and we get the correct thing at the end.