aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-06-14 13:04:05 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-06-14 13:04:05 +0000
commitd8158369c690bbfc758415098c8af499dfebdad7 (patch)
tree5643e580c551f0ac4b115d191271062314f56bdc /gcc/fortran/trans-common.c
parent77a1416d57d6518ba1cc81630625dfdc97053367 (diff)
downloadgcc-d8158369c690bbfc758415098c8af499dfebdad7.zip
gcc-d8158369c690bbfc758415098c8af499dfebdad7.tar.gz
gcc-d8158369c690bbfc758415098c8af499dfebdad7.tar.bz2
re PR fortran/32302 (Incorrect result with -O2)
2007-06-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/32302 * trans-common.c (build_common_decl): If resizing of common decl is needed, update the TREE_TYPE. 2007-06-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/32302 * gfortran.dg/common_resize_1.f90: New test. From-SVN: r125708
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index afcbb1c..78cb7be 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -360,14 +360,15 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
tree size = TYPE_SIZE_UNIT (union_type);
if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size))
{
- /* Named common blocks of the same name shall be of the same size
- in all scoping units of a program in which they appear, but
- blank common blocks may be of different sizes. */
- if (strcmp (com->name, BLANK_COMMON_NAME))
+ /* Named common blocks of the same name shall be of the same size
+ in all scoping units of a program in which they appear, but
+ blank common blocks may be of different sizes. */
+ if (strcmp (com->name, BLANK_COMMON_NAME))
gfc_warning ("Named COMMON block '%s' at %L shall be of the "
"same size", com->name, &com->where);
- DECL_SIZE_UNIT (decl) = size;
- }
+ DECL_SIZE_UNIT (decl) = size;
+ TREE_TYPE (decl) = union_type;
+ }
}
/* If this common block has been declared in a previous program unit,