aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-01-16 12:05:53 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2005-01-16 12:05:53 +0000
commit36c028f675622046a0f0261cc62c70f58e9a3b4b (patch)
treee72be26edb631135d1891d29924473000aacca6d /gcc/fortran/trans-common.c
parent3a2794abdb6a38e8e17108ffbd326b3af910f0ae (diff)
downloadgcc-36c028f675622046a0f0261cc62c70f58e9a3b4b.zip
gcc-36c028f675622046a0f0261cc62c70f58e9a3b4b.tar.gz
gcc-36c028f675622046a0f0261cc62c70f58e9a3b4b.tar.bz2
re PR fortran/17675 ([Regression w.r.t. g77] Alignment constraints not honored in EQUIVALENCE)
2004-01-16 Paul Brook <paul@codesourcery.com> PR fortran/17675 * trans-common.c (translate_common): Remove duplicate function call. (finish_equivalences): Preserve alignment when biasing offsets. testsuite/ * gfortran.dg/common_4.f90: New test. From-SVN: r93724
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 8119cd3..ce6a8b6 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -803,7 +803,6 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
common->name, &common->where);
offset = align_segment (&align);
- apply_segment_offset (current_segment, offset);
if (offset & (max_align - 1))
{
@@ -851,7 +850,8 @@ finish_equivalences (gfc_namespace *ns)
{
gfc_equiv *z, *y;
gfc_symbol *sym;
- HOST_WIDE_INT min_offset;
+ HOST_WIDE_INT offset;
+ unsigned HOST_WIDE_INT align;
for (z = ns->equiv; z; z = z->next)
for (y = z->eq; y; y = y->eq)
@@ -864,13 +864,13 @@ finish_equivalences (gfc_namespace *ns)
/* All objects directly or indirectly equivalenced with this symbol. */
add_equivalences ();
- /* Bias the offsets to to start at zero. */
- min_offset = -current_segment->offset;
+ /* Align the block. */
+ offset = align_segment (&align);
- /* Ensure the block is properly aligned. */
- min_offset += align_segment (NULL);
+ /* Ensure all offsets are positive. */
+ offset -= current_segment->offset & ~(align - 1);
- apply_segment_offset (current_segment, min_offset);
+ apply_segment_offset (current_segment, offset);
/* Create the decl. */
create_common (NULL, current_segment);