C++ structure layout breakage

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Fri Oct 20 18:31:00 GMT 2000


    The new code does not work for C++, because we can't assume that a field
    covers the entire struct if it is the only field.  

Right.  That's basically what I fixed today.

    I propose to partially revert your March 25, Aug 18, and Oct 20
    changes so as to restore the original working code.  I will do so
    unless you can provide an explanation of why the new code is
    necessary.  The corrected code will look like this

	if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field))
	  mode = DECL_MODE (field);

Perhaps you can explain exactly what "covering the entire structure"
means since the details of that predicate are what's at issue here.
I did have something specific in mind when I made that change, but it
was six months ago and I no longer remember what it is.

Perhaps the test for no more fields should be replaced by a loop that
only looks at FIELD_DECLs?


More information about the Gcc-patches mailing list