C++ structure layout breakage
Jim Wilson
wilson@cygnus.com
Sat Oct 21 17:23: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.
No, you didn't fix it, because the broken tests checking to see if this is the
only field are still there. You did add a check to see if the field was the
same size as the structure, but that was present in the original working code.
>Perhaps you can explain exactly what "covering the entire structure"
>means since the details of that predicate are what's at issue here.
It means exactly what you think it means. The field is the same size as
the structure.
>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.
If you were trying to fix a bug, then it should not have been included in
a huge "cleanup" patch. It should have been made separately.
Also, if you were trying to fix a bug, then you should have documented what
the bug was. If you had taken the time to do that, like the rest of us do,
then we would not have a problem with someone unable to remember why a change
was made.
>Perhaps the test for no more fields should be replaced by a loop that
>only looks at FIELD_DECLs?
No, the correct change is to restore the original code that existed before
your March 25 change. That is what I will do on Monday when I get in to work.
If there is a problem with the original code, and I am skeptical that there is,
then it will show up again, and we can not only fix it correctly, but we can
document it too.
Jim
More information about the Gcc-patches
mailing list