[PATCH,fortran]: fix bind(c) common block alignment

Christopher D. Rickett crickett@lanl.gov
Mon Aug 6 17:45:00 GMT 2007



On Mon, 6 Aug 2007, Steve Kargl wrote:

> On Mon, Aug 06, 2007 at 11:17:01AM -0600, Christopher D. Rickett wrote:
>>
>> currently, the patch only changes the alignment if the common block is
>> bind(c), which means the compiler should have already verified that the
>> common block fields interop with C.
>>
>> as to why we weren't seeing it before, i do not know.  the
>> bind_c_coms.f90/bind_c_coms_driver.c illustrates on x86 linux that there
>> is a difference in the alignment.  the generated assembly shows it, but
>> the linker didn't complain.
>>
>> if it is acceptable for all common blocks to choose a C compatible
>> alignment, then the patch is trivial to change to do this.  is that what
>> people prefer?
>>
>
> One thing to keep in mind is derived types that appear in
> common blocks.  These have SEQUENCE, and I suspect the
> current alignment guarantees that SEQUENCE gives expected
> results.
>

in the case of bind(c) common blocks, however, this would not be possible 
since derived types with SEQUENCE are not interoperable (C1501).

Chris



More information about the Gcc-patches mailing list