[Bug fortran/45742] VOLATILE has no effect
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 13 00:15:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45742
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-12 23:55:06 UTC ---
The issue with the dummy is: Volatile will be set in gfc_get_symbol_decl - but
only if there is no backend declaration. For DUMMY arguments there is.
Thus, one needs to handle them differently.
Patch:
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1944,10 +1945,19 @@ create_function_arglist (gfc_symbol * sym)
if (f->sym->attr.proc_pointer)
type = build_pointer_type (type);
+ if (f->sym->attr.volatile_)
+ type = build_qualified_type (type, TYPE_QUAL_VOLATILE);
+
/* Build the argument declaration. */
parm = build_decl (input_location,
PARM_DECL, gfc_sym_identifier (f->sym), type);
+ if (f->sym->attr.volatile_)
+ {
+ TREE_THIS_VOLATILE (parm) = 1;
+ TREE_SIDE_EFFECTS (parm) = 1;
+ }
+
/* Fill in arg stuff. */
DECL_CONTEXT (parm) = fndecl;
DECL_ARG_TYPE (parm) = TREE_VALUE (typelist);
More information about the Gcc-bugs
mailing list