BitCast or GEP?

I have a little simple inheritance thing going on:

%struct.PDFrame = type { i64, i64, i8* }
%struct.PDField = type { %struct.PDFrame, i8 }

Is there any difference between bitcasting a pointer to the struct.PDField to struct.PDFrame, or using GEP to get a pointer to the "super" struct?

I'm not even sure it's possible to bitcast in this situation, but I imagine it should be.

Hi Rick,

I have a little simple inheritance thing going on:

%struct.PDFrame = type { i64, i64, i8* }
%struct.PDField = type { %struct.PDFrame, i8 }

Is there any difference between bitcasting a pointer to the struct.PDField to struct.PDFrame, or using GEP to get a pointer to the "super" struct?

no there isn't. The optimizers will turn the bitcast form into the GEP form as
a normalization.

I'm not even sure it's possible to bitcast in this situation, but I imagine it should be.

Bitcasting a pointer to a pointer is always OK, in fact it's the most common use
of bitcast.

Ciao, Duncan.