This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[fortran,patch] Volatile variable in commons and equivalence groups
- From: FX <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Feb 2008 13:51:13 +0000
- Subject: [fortran,patch] Volatile variable in commons and equivalence groups
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=qdOQe87gax1/HZp4OgbXTAoECHvXJOcsBLX/LluQNxY=; b=ZIG6bWtlw+b2Q4xbteO4vg5H+6r5lAKwbgKzPBa57XFRSJJzKfaTOR5shPhyn91D8sFfK6ADqYDNjOOsOhXV9sfL/ptYPmK9ub/EdUQFxnvHO6gQbszX32u7yNqlPIXzESZkO5NBFYVYyyTaXXPLbytKTyneRVKx+AWFOCQfppc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=pcT8zBSzblECWZ+H6aaVNrhNVRwaLh8SP5g/a3I7BSlWMQZN/wFKbvCA0YAubOPsGg3epJgh/CcbxV/R5hqjvC9JA2hKuYm72yNGsbo6vJ0U0qYPWEAqVGVDoUdrpXao673KRXgSkPd7yYT6IvNGnfnyIkyGLbafAUkvr3pU3FI=
Hi all,
Patch below fixed PR35037, where we used not to mark as volatile the
members of common or equivalence groups. This is straightforward and
well contained, fixes a wrong-code PR, but it's not a regression
AFAIK, so I'm asking it to be reviewed and for the reviewer to
indicate whether it is suitable for inclusion in 4.3.
Bootstrapped and regtested on x86_64-linux, will come with a testcase
(based on -O3 simplification and scanning of the optimized tree dump,
like is done in the PR).
FX
2008-02-05 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/35037
* trans-common.c (build_field): Mark fields as volatile when needed.
Index: trans-common.c
===================================================================
--- trans-common.c (revision 132112)
+++ trans-common.c (working copy)
@@ -318,6 +318,15 @@ build_field (segment_info *h, tree union
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;
}
--
FX Coudert
http://www.homepages.ucl.ac.uk/~uccafco/