aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-05-31 18:40:12 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-05-31 18:40:12 +0200
commit32735518212664a14ebbd6066d7c4d39de8a02cd (patch)
treea35957d4d383ff554c756876803106ed9d58c891 /gcc/cp
parent2664efb66b50f177f99b4555bd8a0791b12cbff7 (diff)
downloadgcc-32735518212664a14ebbd6066d7c4d39de8a02cd.zip
gcc-32735518212664a14ebbd6066d7c4d39de8a02cd.tar.gz
gcc-32735518212664a14ebbd6066d7c4d39de8a02cd.tar.bz2
re PR c++/31806 (miscompilation with -fschedule-insns2 -fno-threadsafe-statics)
PR c++/31806 * decl.c (cp_finish_decl): Also clear was_readonly if a static var needs runtime initialization. From-SVN: r125229
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 885af4f..fe25b5d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/31806
+ * decl.c (cp_finish_decl): Also clear was_readonly if a static var
+ needs runtime initialization.
+
2007-05-31 Paolo Carlini <pcarlini@suse.de>
PR c++/32158
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f28ab09..b485f1f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5361,8 +5361,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
/* If a TREE_READONLY variable needs initialization
at runtime, it is no longer readonly and we need to
avoid MEM_READONLY_P being set on RTL created for it. */
- if (init && TREE_READONLY (decl))
- TREE_READONLY (decl) = 0;
+ if (init)
+ {
+ if (TREE_READONLY (decl))
+ TREE_READONLY (decl) = 0;
+ was_readonly = 0;
+ }
expand_static_init (decl, init);
}
}