This is the mail archive of the
mailing list for the GCC project.
Re: [Fortran,Patch] PR 46638 Wrong results with TRANSFER to derived types
- From: Jerry DeLisle <jvdelisle at frontier dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 24 Nov 2010 08:35:47 -0800
- Subject: Re: [Fortran,Patch] PR 46638 Wrong results with TRANSFER to derived types
- References: <4CED2E65.email@example.com>
On 11/24/2010 07:25 AM, Tobias Burnus wrote:
The code for simplifying the TRANSFER to a derived type assumed that the
elements are all offset by the amount DECL_FIELD_OFFSET (in bytes). However,
that's only the case if each element has the size of DECL_OFFSET_ALIGN -- or
larger. On my system, that's chunks of 16 byte. Thus, for all components whose
size is smaller, the result will be wrong.
The trick is to add to DECL_FIELD_OFFSET additionally the bits of
DECL_FIELD_BIT_OFFSET -- that actually done for transferring the data from a
[Instead of using the magical number "8" one could also use BITS_PER_UNIT (and
add #include "default.h").]
Build and regtested on x86-64-linux.
OK for the trunk and 4.4/4.5?
OK, thanks for quick fix