On 03/11/2011 03:01 AM, Jakub Jelinek wrote:
Do we need to redo parts of class.c anyway? From what I understand, the problematic vtbl pointers are at the end of the base types and DECL_SIZE is set to the CLASSTYPE_AS_BASE type size, thus those pointers ought to be at or beyond the containing field's size. So, can't we simply skip subfields whose bit_position is equal or larger to containing field's size? Something like (works on the testcase from this PR, otherwise untested):
Sure, that should work. I had been thinking of stopping when we run out of fields in CLASSTYPE_AS_BASE, but your approach seems simpler.
Or, in the simplify_aggr_init case where the created tree is handed immediately to the gimplifier, there is IMHO no point in initializing all fields to zero when the gimplifier throws that immediately away again.
Unfortunately, pointers to data members make this not good enough: zero-initializing one means setting the bits to -1. Though I suppose we could keep track of whether or not a class has a pointer to data member field somewhere (and therefore need to do this the hard way) and if not, just use an empty CONSTRUCTOR.
Jason
