https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96993

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
offsetof existed since forever and is portable.
Anyway, I think Richard's change is completely fine and the testcase is broken
in many ways, most importantly in what the commit talks about, that a
difference of pointers should never produce a valid pointer.
So, instead of
(tUint8 *)(address_) - (tUint8 *)(&((struct tmm_blk_free_head_t
*)0)->ql.column_list)
you should use
(tUint8 *)(address_) - offsetof (struct tmm_blk_free_head_t, ql.column_list)
or worst case
(tUint8 *)(address_) - ((tUint8 *)(&((struct tmm_blk_free_head_t
*)0)->ql.column_list) - (tUint8 *)0), i.e. subtract from a pointer some
integer, rather than pretending that from the difference of two pointers you
get something that is a valid address and can be dereferenced.

Reply via email to