https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101062
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, and there is also a problem that for bitfields in unions we don't create DECL_BIT_FIELD_REPRESENTATIVE in finish_bitfield_layout and so then get_bit_range returns { 0, 0 } as bitstart, bitend and so the access isn't really restricted. So, wonder, shall we for bitfields in UNION_TYPE in get_bit_range return the range of the union? Or is it ok for d[4].b RMW to update also d[5].b next to it, just not anything beyond end of the variable (so essentially set bitregion_start/bitregion_end to the start and end of d variable), something else? At least for multithreaded apps, even the modification of another element of the same array seems bad to me. Does Ada allow bitfields in unions and if yes, what does it want for those? Changing the testcase with sed -i -e s/union/struct/g fixes the bug...