[PATCH]: Fix PR tree-optimization/21407

Zack Weinberg zack@codesourcery.com
Wed May 11 19:35:00 GMT 2005


Mike Stump <mrs@apple.com> writes:

> 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.
[...]

I must point out that upcasting from the middle of a record is used in
GCC itself:

/* Translate a hash table identifier pointer to a tree_identifier
   pointer, and vice versa.  */

#define HT_IDENT_TO_GCC_IDENT(NODE) \
  ((tree) ((char *) (NODE) - sizeof (struct tree_common)))
#define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NODE))->id)

zw



More information about the Gcc-patches mailing list