The expression &ptr->fld
doesn't represent a dereference, instead it should be treated as (uint32_t)ptr + offsetof (ptr, fld)
. I am certain that GCC does this simplification, but I cannot find where in the code.
The above ends up as ADDR_EXPR(COMPONENT_REF (INDIRECT_REF (ptr), fld))
in the AST, but at some point it should go through and simplify it. Having looked up almost every occurrence of ADDR_EXPR, COMPONENT_REF, and INDIRECT_REF in the gcc tree, I'm having trouble discovering where. Any ideas?
Note that I've tried seeking out help from GCC people. In general they're pretty unhelpful, but people here may know the answer. If this is a bad question I'll understand if it's closed.