http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45742

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-12 
23:32:06 UTC ---
OK. The (j>j) and the tree->RTL issue are solved by the following patch. Thanks
to Andrew, Ian, Richard et al. (at #gcc) for the debugging help.


diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 486fbbb..1f59a69 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -322,6 +322,7 @@ build_field (segment_info *h, tree union_type,
record_layout_info rli)
     {
       tree new_type;
       TREE_THIS_VOLATILE (field) = 1;
+      TREE_SIDE_EFFECTS (field) = 1;
       new_type = build_qualified_type (TREE_TYPE (field), TYPE_QUAL_VOLATILE);
       TREE_TYPE (field) = new_type;
     }
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 3f068de..845c96b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -555,6 +555,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
   if (sym->attr.volatile_)
     {
       TREE_THIS_VOLATILE (decl) = 1;
+      TREE_SIDE_EFFECTS (decl) = 1;
       new_type = build_qualified_type (TREE_TYPE (decl), TYPE_QUAL_VOLATILE);
       TREE_TYPE (decl) = new_type;
     }

Reply via email to