summaryrefslogtreecommitdiff
path: root/gcc/explow.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-07 22:57:41 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-07 22:57:41 +0000
commita86696c32abbde9a61f5bb9af8e19b5ad80e3bc8 (patch)
tree5c9af0f6f2b13994e8a18e00191c5bf0c49f5ad6 /gcc/explow.c
parent930f9e9226cc2fcb3ea841193b3b41e056ee61c5 (diff)
downloadgcc-a86696c32abbde9a61f5bb9af8e19b5ad80e3bc8.tar.gz
PR opt/8634
* explow.c (maybe_set_unchanging): Don't flag non-static const aggregate type initializers with RTX_UNCHANGING_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65352 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/explow.c')
-rw-r--r--gcc/explow.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/explow.c b/gcc/explow.c
index 50556e8d6bf..9ed034eb1a9 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -657,8 +657,18 @@ maybe_set_unchanging (ref, t)
/* We can set RTX_UNCHANGING_P from TREE_READONLY for decls whose
initialization is only executed once, or whose initializer always
has the same value. Currently we simplify this to PARM_DECLs in the
- first case, and decls with TREE_CONSTANT initializers in the second. */
+ first case, and decls with TREE_CONSTANT initializers in the second.
+
+ We cannot do this for non-static aggregates, because of the double
+ writes that can be generated by store_constructor, depending on the
+ contents of the initializer. Yes, this does eliminate a good fraction
+ of the number of uses of RTX_UNCHANGING_P for a language like Ada.
+ It also eliminates a good quantity of bugs. Let this be incentive to
+ eliminate RTX_UNCHANGING_P entirely in favour of a more reliable
+ solution, perhaps based on alias sets. */
+
if ((TREE_READONLY (t) && DECL_P (t)
+ && (TREE_STATIC (t) || ! AGGREGATE_TYPE_P (TREE_TYPE (t)))
&& (TREE_CODE (t) == PARM_DECL
|| (DECL_INITIAL (t) && TREE_CONSTANT (DECL_INITIAL (t)))))
|| TREE_CODE_CLASS (TREE_CODE (t)) == 'c')