aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-10-09 21:37:47 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-10-09 21:37:47 +0200
commit7de61dc6ac5ec699bffb6af49636db501f436004 (patch)
tree38807adc0309dc6dbf59b746024f9e1cbd0017d2 /gcc/fortran/trans-common.c
parent0cc8903520c9aff729ed624d4ae4510cb721e7ba (diff)
downloadgcc-7de61dc6ac5ec699bffb6af49636db501f436004.zip
gcc-7de61dc6ac5ec699bffb6af49636db501f436004.tar.gz
gcc-7de61dc6ac5ec699bffb6af49636db501f436004.tar.bz2
re PR fortran/45044 (Different named COMMON block size: No warning)
2011-10-09 Tobias Burnus <burnus@net-b.de> PR fortran/45044 * trans-common.c (translate_common): Fix -Walign-commons check. 2011-10-09 Tobias Burnus <burnus@net-b.de> PR fortran/45044 * gfortran.dg/common_14.f90: Compile with -Wno-align-commons. * gfortran.dg/common_16.f90: New. From-SVN: r179729
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 21237c8..61ce44b 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -1067,14 +1067,12 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
HOST_WIDE_INT offset;
HOST_WIDE_INT current_offset;
unsigned HOST_WIDE_INT align;
- unsigned HOST_WIDE_INT max_align;
bool saw_equiv;
common_segment = NULL;
offset = 0;
current_offset = 0;
align = 1;
- max_align = 1;
saw_equiv = false;
/* Add symbols to the segment. */
@@ -1117,7 +1115,7 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
if (gfc_option.flag_align_commons)
offset = align_segment (&align);
- if (offset & (max_align - 1))
+ if (offset)
{
/* The required offset conflicts with previous alignment
requirements. Insert padding immediately before this
@@ -1140,8 +1138,6 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
/* Apply the offset to the new segments. */
apply_segment_offset (current_segment, offset);
current_offset += offset;
- if (max_align < align)
- max_align = align;
/* Add the new segments to the common block. */
common_segment = add_segments (common_segment, current_segment);
@@ -1161,11 +1157,11 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
if (common_segment->offset != 0 && gfc_option.warn_align_commons)
{
if (strcmp (common->name, BLANK_COMMON_NAME))
- gfc_warning ("COMMON '%s' at %L requires %d bytes of padding at start; "
+ gfc_warning ("COMMON '%s' at %L requires %d bytes of padding; "
"reorder elements or use -fno-align-commons",
common->name, &common->where, (int)common_segment->offset);
else
- gfc_warning ("COMMON at %L requires %d bytes of padding at start; "
+ gfc_warning ("COMMON at %L requires %d bytes of padding; "
"reorder elements or use -fno-align-commons",
&common->where, (int)common_segment->offset);
}