This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ structure layout breakage


I did a ia32-linux "make bootstrap" and testsuite run with my proposed patch,
and found a problem.  One gcc testcase fails.  compile/20000818-1.c.  This is
the testcase that was added for Kenner's second patch on Aug 18.   However,
Kenner's solution is not correct.  The real problem here is a patch that
Richard Henderson added two years ago.  I found this by comparing current
gcc sources against gcc-2.8.1.

Fri Oct  9 15:49:29 1998  Richard Henderson  <rth@cygnus.com>

	* expmed.c (store_bit_field): Pun non-integral str_rtx modes.
	Take extra care for op0 now possibly being a subreg.
	(extract_bit_field): Likewise.

This was an attempt to fix purge_addressof problems.  Along the way, it was
decided that store_bit_field should abort if given an FP mode with no
equivalent integer mode.  This is wrong.  FP modes are fine if we are inserting
a value that is exactly the same size as the field we are inserting it into,
and the field is aligned properly for the type.  FP modes have to work here,
because this routine gets called when storing into a field in a structure
when the structure has been allocated to a pseudo.  This can happen when the
structure has only one FIELD_DECL.  The testcase has a structure with one
long double field, and there is no 80-bit integral type.  If we don't allow
this structure into a register, then we are accidentally changing the x86 ABI,
and getting less efficient code too.

The message containing the patch is here:
http://gcc.gnu.org/ml/gcc-patches/1998-10/msg00275.html
Some useful discussion is here:
http://gcc.gnu.org/ml/gcc-patches/1998-10/msg00143.html
If you want to see the whole discussion, look at all of the Oct 98 messages
with "Your change to function.c" in the subject line.

Since this has gotten more complicated, I have not yet checked in any patch.
So far, I've found four changes which are incorrect and need to be fixed:
Kenner's Mar 25, Aug 18, and Oct 20 changes to compute_record_mode, and
Richard Henderson's Oct 9, 1998 change to store_bit_field.

I need to take a closer look at Richard Henderson's change and figure out how
to fix it.

Jim

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]