From 964a98317cdebd20f9d2f034068ee7246ce62ff8 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 24 Feb 2005 17:56:14 -0800 Subject: [PATCH] re PR tree-optimization/20127 (wrong code for volatile struct members) PR tree-opt/20127 * tree-sra.c (instantiate_element): Copy TREE_THIS_VOLATILE from the type. From-SVN: r95530 --- gcc/ChangeLog | 6 ++++++ gcc/tree-sra.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36d0804bbd5..26aea68902a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-02-24 Richard Henderson + + PR tree-opt/20127 + * tree-sra.c (instantiate_element): Copy TREE_THIS_VOLATILE from + the type. + 2005-02-24 Fariborz Jahanian * config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Check for diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 15109045375..267655d4bdf 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1116,6 +1116,12 @@ instantiate_element (struct sra_elt *elt) DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base); DECL_ARTIFICIAL (var) = 1; + if (TREE_THIS_VOLATILE (elt->type)) + { + TREE_THIS_VOLATILE (var) = 1; + TREE_SIDE_EFFECTS (var) = 1; + } + if (DECL_NAME (base) && !DECL_IGNORED_P (base)) { char *pretty_name = build_element_name (elt);