Did you test Ada and enable the C++ memory model? ;)
See my earlier comment on Ada. Who would ever use the C++ memory model
on Ada?
Btw, even if the bitfield we access (and thus the whole region) is at a
constant offset, the field _following_ the bitregion (the one you query
above with get_inner_reference) can be at variable offset. I suggest
to simply not include any padding in that case (which would be,
TREE_CODE (DECL_FIELD_OFFSET (fld)) != INTEGER_CST).
I still have not found a place where we get a variable offset here
(after folding the computation). How about we put a gcc_assert() along
with a big fat comment with your above suggestion when we encounter
this. Or can you give me an example of this case?
Is what you want, that we call get_inner_reference once, and then use
DECL_FIELD_OFFSET+DECL_FIELD_BIT_OFFSET to calculate any subsequent bit
offset? I found this to be quite tricky with padding, and such, but am
willing to give it a whirl again.
Yes.
I have added a comment to this effect, and will address it along with
the get_inner_reference() removal you have suggested as a followup.