﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
253	Plan-9 with dynamic layout gives wrong field offsets	mlbrooks	Michael Brooks <mlbrooks@…>	"Subsequent plan9-inlined fields (which make the owning struct have multiple inheritance) are unusable when the owning struct has dynamic layout (a layout that varies according to the size of a sized-T parameter), because uses of such fields get the wrong offset.

{{{

forall( T )
struct thing {
    T q;            // variable-sized padding
    inline double;
    inline float;
};

#define SHOW_OFFSETS \
    double & x_inner_double = x; \
    float  & x_inner_float  = x; \
    printf(""  offset of inner double: %ld\n"", ((char *) & x_inner_double) - ((char *) & x) ); \
    printf(""  offset of inner float:  %ld\n"", ((char *) & x_inner_float ) - ((char *) & x) );

void showStatic( thing(int) & x ) {
    printf(""static:\n"");
    SHOW_OFFSETS
}

forall( T )
void showDynamic( thing(T) & x ) {
    printf(""dynamic:\n"");
    SHOW_OFFSETS
}

int main() {
    thing(int) x;
    showStatic(x);
    showDynamic(x);
}

}}}

Actual: Runs with output showing inconsitent offset of second inlined field (float)
{{{
static:
  offset of inner double: 8
  offset of inner float:  16
dynamic:
  offset of inner double: 8
  offset of inner float:  8
}}}

Expected:  Runs with output showing consitent offset of second inlined field (float)
{{{
static:
  offset of inner double: 8
  offset of inner float:  16
dynamic:
  offset of inner double: 8
  offset of inner float:  16
}}}
"	defect	closed	minor	cfa-cc	1.0	fixed		
