This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Fix PR tree-optimization/21407




Mike Stump wrote:
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.
In real law, as opposed to language law, there is the convention that if you single out one or more special cases, then the rules only apply to those special cases. Only if you do not single out the special cases, are the rules generally applied. I assume from your and mark's position that this is not the way that language standards are to be interpreted.

Kenny



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]