aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-common.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2008-02-05 21:06:32 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2008-02-05 21:06:32 +0000
commite3ac9b24a77b39ecd1e954c4d34957ee9e4ac1c0 (patch)
tree3270a822480b22cb5e3633ff14ad2ae61bed170c /gcc/fortran/trans-common.c
parentda36ba2754d0ab1b9ac9603c939e8b83f1857a30 (diff)
downloadgcc-e3ac9b24a77b39ecd1e954c4d34957ee9e4ac1c0.zip
gcc-e3ac9b24a77b39ecd1e954c4d34957ee9e4ac1c0.tar.gz
gcc-e3ac9b24a77b39ecd1e954c4d34957ee9e4ac1c0.tar.bz2
re PR fortran/35037 (VOLATILE attribute not being honored with common block variable)
PR fortran/35037 * trans-common.c (build_field): Mark fields as volatile when needed. * gfortran.dg/volatile11.f90: New test. From-SVN: r132129
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r--gcc/fortran/trans-common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 64cee0d..a8e1126 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -318,6 +318,15 @@ build_field (segment_info *h, tree union_type, record_layout_info rli)
GFC_DECL_ASSIGN_ADDR (field) = pushdecl_top_level (addr);
}
+ /* If this field is volatile, mark it. */
+ if (h->sym->attr.volatile_)
+ {
+ tree new;
+ TREE_THIS_VOLATILE (field) = 1;
+ new = build_qualified_type (TREE_TYPE (field), TYPE_QUAL_VOLATILE);
+ TREE_TYPE (field) = new;
+ }
+
h->field = field;
}