On Wed, Jan 25, 2023 at 08:44:31AM +0100, Richard Biener wrote: > > --- a/gcc/tree-object-size.cc > > +++ b/gcc/tree-object-size.cc > > @@ -412,7 +412,9 @@ compute_object_offset (const_tree expr, const_tree var) > > return base; > > > > t = TREE_OPERAND (expr, 1); > > - off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t), > > + off = size_binop (PLUS_EXPR, > > + (TREE_OPERAND (expr, 2) ? TREE_OPERAND (expr, 2) > > + : DECL_FIELD_OFFSET (t)), > > That isn't correct - operand 2 is the field offset in units of > DECL_OFFSET_ALIGN (t) / BITS_PER_UNIT. > See component_ref_filed_offset (), maybe you should be using that > function instead?
Oops. s/filed/field/ I was looking for such a function, but didn't find it last night :(. Jakub