From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Wilson To: mrs@wrs.com (Mike Stump) Cc: egcs@cygnus.com Subject: Re: m68k structure packing Date: Tue, 30 Sep 1997 18:20:00 -0000 Message-id: <199710010119.SAA27460@cygnus.com> References: <199709302357.QAA07269@kankakee.wrs.com> X-SW-Source: 1997-09/msg01170.html I would be interested in any such cases that you know of. It will happen for the m68k ports, of course, which are the ones that you are trying to fix. This problem has been discussed before, and is well known. There are many places in the code that document it. See in particular the discussion of PCC_BITFIELD_TYPE_MATTERS in the tm.texi file. Note that most m68k ports do not define PCC_BITFIELD_TYPE_MATTERS, and hence must define STRUCTURE_SIZE_BOUNDARY to >=16, and hence must not allow structure packing. The m68kemb.h file goes the other way, defining PCC_BITFIELD_TYPE_MATTERS, and defining STRUCTURE_SIZE_BOUNDARY to 8, and hence does allow structure packing. If you want structure packing, this is what you should do. Why do you think generated code will fail? Because I have seen the problem before, and I have seen it so many times that it falls into the category of things that are obvious to me, but which I can't easily explain because I forgot the reasons for it long ago. My recollection is that it will only fail if you compile for the 68000, because the 68000 has no bit field instructions, and requires 2 byte alignment for non-byte loads/stores. (As per the PCC_BITFIELD_TYPE_MATTERS documentation.) Most other 68k family members do not have both these restrictions. Further, Kamil has claimed that the amiga m68k port works fine with STRUCTURE_SIZE_BOUNDARY as 8. It will appear to work fine until you trigger the bug. Obviously, he did not try any testcase that would trigger the bug. Probably because he did not test on a m68000. Maybe if you describe that case I can hunt for it. I believe it has already been described: >From: Andreas Schwab >The only place where it can fail is on a STRICT_ALIGNMENT target when >using a packed structure in an array. I think that in the absence a bug that can be reproduced, Unfortunately, you are putting the burden in the wrong place. I am much busier than you, and do not have time to search for a testcase to reproduce a bug that I already know exists. I would prefer that you put some effort into demonstrating that the known bug does not exist with your patch. It should be easy to prove or disprove this with some simple experimentation. First demonstrate the problem that exists as per the PCC_BITFIELD_TYPE_MATTERS documentation. Then check to see if your patch triggers this bug. I believe that it does. Because the patch is already in the FSF gcc sources, it will probably also be added to the EGCS sources. However, I think it is important for you to understand that this is not the `bug fix' patch that you think it is. What this patch does is trade one set of complex problems for a different set of complex problems, and it is not clear which set of problems is worse. After we do install the patch, we may end up needing to remove it if the new set of problems are worse than the old set. Jim