[gfortran] Fix common block alignment (PR17675)

Paul Brook paul@codesourcery.com
Sun Jan 9 22:57:00 GMT 2005


The attached patch fixed common and equivalence block alignment issues, as 
described in PR17675. I think the behaviour is the same as g77. when possible 
padding is inserted at the start of the block to ensure correct alignment. If 
this is not sufficient then additional padding is inserted immediately before 
subsequent unaligned members. it also verifies that equivalences do not 
violate alignment constraints.

We were getting common block layout wrong when multiple variables in the same 
common block were related via equivalence statement. The patch fixes this and 
verifies that the variables end up where we expect them.

Tested on i686-linux.
Applied to mainline.

Paul

2005-01-09  Paul Brook  <paul@codesourcery.com>

 PR fortran/17675
 * trans-common.c (current_common, current_offset): Remove.
 (create_common): Add head argument.
 (align_segment): New function.
 (apply_segment_offset): New function.
 (translate_common): Merge code from new_segment.  Handle alignment.
 (new_segment): Remove.
 (finish_equivalences): Ensure proper alignment.
testsuite/
 * gfortran.dg/common_2.f90: New file.
 * gfortran.dg/common_3.f90: New file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.common_equiv
Type: text/x-diff
Size: 10022 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050109/a305cb0e/attachment.bin>


More information about the Gcc-patches mailing list