From 0154eaa8122a7a848fd40a79d30d3835508e2ab6 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 7 Apr 2002 06:09:27 +0000 Subject: re PR c++/5571 (crash in initialization of a static variable) PR c++/5571 * stor-layout.c (layout_decl): Reset the RTL for the decl. * class.c (layout_class_type): Remember incomplete static variables. (finish_struct_1): Call complete_vars, not hack_incomplete_structures. * cp-tree.h (hack_incomplete_structures): Rename to ... (complete_vars): ... this. (struct saved_scope): Remove incomplete. (namespace_scope_incomplete): Remove. * decl.c (struct binding_level): Remove incomplete. (incomplete_vars): New variable. (mark_binding_level): Don't mark incomplete. (print_binding_level): Don't print it. (mark_saved_scope): Don't mark incomplete. (pushdecl): Use maybe_register_incopmlete_var. (cxx_init_decl_processing): Register incomplete_vars for GC. (start_decl_1): Clarify error message. (hack_incomplete_vars): Remove. (maybe_register_incomplete_var): New function. (complete_vars): Likewise. * g++.dg/opt/static2.C: New test. From-SVN: r51978 --- gcc/stor-layout.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index baf26dd..fbf5e4f 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -461,6 +461,11 @@ layout_decl (decl, known_align) larger_than_size); } } + + /* If there was already RTL for this DECL, as for a variable with an + incomplete type whose type is completed later, update the RTL. */ + if (DECL_RTL_SET_P (decl)) + make_decl_rtl (decl, NULL); } /* Hook for a front-end function that can modify the record layout as needed -- cgit v1.1