public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR58300, issue with -fvtable-verify=preinit
@ 2013-09-05 22:35 Caroline Tice
  2013-09-06 17:40 ` [C++ PATCH] " Paolo Carlini
  2013-09-07 16:53 ` [PATCH] " Jason Merrill
  0 siblings, 2 replies; 4+ messages in thread
From: Caroline Tice @ 2013-09-05 22:35 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

This fixes a bug where using -fvtable-verify=preinit sometimes causes
an ICE.  In particular, when the preinit flag was used, the vtable
verification constructor initialization function was being written to
the assembly file before it was being checked with
cgraph_process_new_functions.  This sometimes caused an assertion
failure in decide_is_symbol_needed.  This patch fixes the problem by
reordering events so that the function is written to the assembly file
after the call to cgraph_process_new_functions.  I have verified that
this fixes the test case attached to the bug, and it has passed all my
regular vtable verification tests.   Is this patch ok to commit?

-- Caroline Tice
cmtice@google.com


2013-09-04  Caroline Tice  <cmtice@google.com>

        PR c++/58300
        * vtable-class-hierarchy.c (vtv_generate_init_routine): In
        preinit case, move call to assemble_vtv_preinit_initializer to
       after call to cgraph_process_new_functions.

[-- Attachment #2: bug-58300.patch --]
[-- Type: application/octet-stream, Size: 873 bytes --]

Index: gcc/cp/vtable-class-hierarchy.c
===================================================================
--- gcc/cp/vtable-class-hierarchy.c	(revision 202296)
+++ gcc/cp/vtable-class-hierarchy.c	(working copy)
@@ -1179,15 +1179,16 @@ vtv_generate_init_routine (void)
       TREE_USED (vtv_fndecl) = 1;
       DECL_PRESERVE_P (vtv_fndecl) = 1;
       if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
-        {
-          DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;
-          assemble_vtv_preinit_initializer (vtv_fndecl);
-        }
+        DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;
 
       gimplify_function_tree (vtv_fndecl);
       cgraph_add_new_function (vtv_fndecl, false);
 
       cgraph_process_new_functions ();
+
+      if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
+        assemble_vtv_preinit_initializer (vtv_fndecl);
+
     }
   pop_lang_context ();
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-07 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-05 22:35 [PATCH] Fix PR58300, issue with -fvtable-verify=preinit Caroline Tice
2013-09-06 17:40 ` [C++ PATCH] " Paolo Carlini
2013-09-07 16:53 ` [PATCH] " Jason Merrill
2013-09-07 16:54   ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).