When I compile my project for IR, I get the following structure definition:
%class.Location = type { i8, i32, i32, i32 }
I then compiled my project as an executable and debugged it using gdb (I didn’t generate the executable from IR, I recompiled it once).
I used gdb to output the definition of the structure/class and it returned me the following result:
/* 26074 | 16 */ class Location {
public:
/* 26074: 0 | 1 */ uint8_t relative_alt : 1;
/* 26074: 1 | 1 */ uint8_t loiter_ccw : 1;
/* 26074: 2 | 1 */ uint8_t terrain_alt : 1;
/* 26074: 3 | 1 */ uint8_t origin_alt : 1;
/* 26074: 4 | 1 */ uint8_t loiter_xtrack : 1;
/* XXX 3-bit hole */
/* XXX 3-byte hole */
/* 26078 | 4 */ int32_t alt;
/* 26082 | 4 */ int32_t lat;
/* 26086 | 4 */ int32_t lng;
private:
static const float LOCATION_SCALING_FACTOR;
static const float LOCATION_SCALING_FACTOR_INV;
/* total size (bytes): 16 */
} _target_location;
Obviously the two structures are not the same size, anyone tell me why?