This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/35037] VOLATILE attribute not being honored with common block variable
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2008 22:54:56 -0000
- Subject: [Bug fortran/35037] VOLATILE attribute not being honored with common block variable
- References: <bug-35037-15045@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2008-02-01 22:54 -------
I've tried the following "trivial" patch (which should handle both common
blocks and equivalences):
Index: trans-common.c
===================================================================
--- trans-common.c (revision 131944)
+++ trans-common.c (working copy)
@@ -678,6 +678,14 @@ create_common (gfc_common_head *com, seg
/* This is a fake variable just for debugging purposes. */
TREE_ASM_WRITTEN (var_decl) = 1;
+ if (s->sym->attr.volatile_)
+ {
+ tree new;
+ TREE_THIS_VOLATILE (var_decl) = 1;
+ new = build_qualified_type (TREE_TYPE (var_decl),
TYPE_QUAL_VOLATILE);
+ TREE_TYPE (var_decl) = new;
+ }
+
if (com)
var_decl = pushdecl_top_level (var_decl);
else
But it looks like it doesn't work. Actually, even without the common block, it
doesn't seem to work:
subroutine wait4it ()
logical event
volatile event
do
if (event) exit
end do
end subroutine
But I'm useless at reading assembly (the tree dump doesn't have these
attributes written out) and I'm not too sure if the code above is legal, so I'd
be glad for someone to help.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35037