diff options
author | Jan Hubicka <jh@suse.cz> | 2014-01-17 02:04:59 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-01-17 01:04:59 +0000 |
commit | f910753dbe1faad4ec8295f621c5177214fe8232 (patch) | |
tree | a2d3c118085cdca5895c149b8c25b020c147fc99 /gcc/tree.c | |
parent | 906641605ffa86e1ab4173779dd72ea5e04ae78b (diff) | |
download | gcc-f910753dbe1faad4ec8295f621c5177214fe8232.zip gcc-f910753dbe1faad4ec8295f621c5177214fe8232.tar.gz gcc-f910753dbe1faad4ec8295f621c5177214fe8232.tar.bz2 |
re PR ipa/59775 (internal compiler error: Segmentation fault)
PR ipa/59775
* tree.c (get_binfo_at_offset): Look harder for virtual bases.
From-SVN: r206694
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -11995,16 +11995,35 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) represented in the binfo for the derived class. */ else if (offset != 0) { - tree base_binfo, found_binfo = NULL_TREE; - for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++) - if (types_same_for_odr (TREE_TYPE (base_binfo), TREE_TYPE (fld))) - { - found_binfo = base_binfo; - break; - } - if (!found_binfo) - return NULL_TREE; - binfo = found_binfo; + tree base_binfo, binfo2 = binfo; + + /* Find BINFO corresponding to FLD. This is bit harder + by a fact that in virtual inheritance we may need to walk down + the non-virtual inheritance chain. */ + while (true) + { + tree containing_binfo = NULL, found_binfo = NULL; + for (i = 0; BINFO_BASE_ITERATE (binfo2, i, base_binfo); i++) + if (types_same_for_odr (TREE_TYPE (base_binfo), TREE_TYPE (fld))) + { + found_binfo = base_binfo; + break; + } + else + if (BINFO_OFFSET (base_binfo) - BINFO_OFFSET (binfo) < pos + && (!containing_binfo + || (BINFO_OFFSET (containing_binfo) + < BINFO_OFFSET (base_binfo)))) + containing_binfo = base_binfo; + if (found_binfo) + { + binfo = found_binfo; + break; + } + if (!containing_binfo) + return NULL_TREE; + binfo2 = containing_binfo; + } } type = TREE_TYPE (fld); |