[PATCH, PR 66521] Fix bootstrap segfault with vtable verification enabled

Caroline Tice cmtice@google.com
Tue Jul 28 17:57:00 GMT 2015


I believe the following patch fixes a problem with bootstrap failures
on some architectures with vtable verification enabled.  The problem
was related to a change in name mangling, where classes with anonymous
namespaces get "<anon>" as their DECL_ASSEMBLER_NAME, rather than the
real mangled name.  This was causing multiple problems for vtable
verification, since not only do we use the mangled name to uniquely
identify the various classes (the anonymous classes were no longer
being properly 'uniqued'), but also the DECL_ASSEMBLER_NAME was being
incorporated into our variable names and ending up in the assembly
code and  angle-brackets are not legal there.

This patch should fix those problems, as well as a few other minor
issues I found while working on this.

I have bootstrapped with this patch on an x85_64 linux system; I have
run all the testsuites with no regressions; and I have verified that
it fixes the problem.  Is this ok to commit?

-- Caroline Tice
cmtice@google.com

ChangeLogs:

libvtv/ChangeLog

2015-07-28  Caroline Tice  <cmtice@google.com>

        PR 66521
        * Makefile.am: Update to match latest tree.
        * Makefile.in: Regenerate.
        * testsuite/lib/libvtv: Brought up to date.
        * vtv_malloc.cc (VTV_DEBUG): Update function call to match renamed
        function (old bug!).
        * vtv_rts.cc (debug_functions, debug_init, debug_verify_vtable): Update
        initializations to work correctly with VTV_DEBUG defined.

gcc/ChangeLog:

2015-07-28  Caroline Tice  <cmtice@google.com>

PR 66521
* vtable-verify.c (vtbl_mangled_name_types, vtbl_mangled_name_ids): New
global variables.
(vtbl_find_mangled_name):  New function.
(vtbl_register_mangled_name):  New function.
(vtbl_map_get_node):  If DECL_ASSEMBLER_NAME is "<anon>", look up
mangled name in mangled name vectors.
(find_or_create_vtbl_map_node):  Ditto.
(var_is_used_for_virtual_call_p):  Add recursion_depth parameter;
update recursion_depth on function entry; pass it to every recursive
call; automatically exit if depth > 25 (give up looking at that point).
(verify_bb_vtables):  Initialize recursion_depth and pass it to
var_is_used_for_virtual_call_p.
* vtable-verify.h (vtbl_mangbled_name_types, vtbl_mangled_name_ids): New
global variable decls.
(vtbl_register_mangled_name): New extern function decl.

gcc/cp/ChangeLog:
2015-07-28  Caroline Tice  <cmtice@google.com>

PR 66521
* mangle.c : Add vtable-verify.h to include files.
(get_mangled_vtable_map_var_name):  If the DECL_ASSEMBLER_NAME
is "<anon>" get the real mangled name for the class instead, and
also store the real mangled name in a vector for use later.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-fsf-vtv.patch
Type: text/x-patch
Size: 11280 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150728/d8132950/attachment.bin>


More information about the Gcc-patches mailing list