[PATCH]: Fix PR tree-optimization/21407

Mike Stump mrs@apple.com
Wed May 11 19:28:00 GMT 2005


On May 11, 2005, at 5:25 AM, Kenneth Zadeck wrote:
> I wonder, Mike, do you make any distinction between a c program  
> that upcasts on the first field of a record and one that uses the  
> offsetof operator to upcast from the middle of a record?

I don't, but Geoff does as I recall, which is I think what your  
question was.  As I recall, everyone agrees the C standard says the  
first field is special, you can convert between the pointer to the  
first field and the structure (I'm only considering struct here, not  
union):

        [#12]  Within  a structure object, the non-bit-field members
        and the units in which bit-fields reside have addresses that
        increase in the order in which they are declared.  A pointer
        to a structure object, suitably  converted,  points  to  its
        initial  member  (or  if that member is a bit-field, then to
        the unit in which it resides), and vice versa.



More information about the Gcc-patches mailing list