aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2010-06-28 17:42:01 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2010-06-28 17:42:01 +0200
commit621f418948dd050f09735532c098e46eaa1dfd69 (patch)
tree745ee01b97de27435cfc7d6c86ecfc573129a1f0 /gcc/gimple-fold.c
parentfe2ef088e065f9e15311b221db3fcbf864dfb250 (diff)
downloadgcc-621f418948dd050f09735532c098e46eaa1dfd69.zip
gcc-621f418948dd050f09735532c098e46eaa1dfd69.tar.gz
gcc-621f418948dd050f09735532c098e46eaa1dfd69.tar.bz2
re PR c++/44535 (g++ -O[ 23] generates undefined symbol)
2010-06-28 Martin Jambor <mjambor@suse.cz> PR c++/44535 * gimple-fold.c (get_first_base_binfo_with_virtuals): New function. (gimple_get_relevant_ref_binfo): Use get_first_base_binfo_with_virtuals instead of BINFO_BASE_BINFO. * testsuite/g++.dg/torture/pr44535.C: New test. From-SVN: r161498
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 8fb604d..491611f 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1476,6 +1476,22 @@ gimple_fold_builtin (gimple stmt)
return result;
}
+/* Return the first of the base binfos of BINFO that has virtual functions. */
+
+static tree
+get_first_base_binfo_with_virtuals (tree binfo)
+{
+ int i;
+ tree base_binfo;
+
+ for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
+ if (BINFO_VIRTUALS (base_binfo))
+ return base_binfo;
+
+ return NULL_TREE;
+}
+
+
/* Search for a base binfo of BINFO that corresponds to TYPE and return it if
it is found or NULL_TREE if it is not. */
@@ -1531,8 +1547,8 @@ gimple_get_relevant_ref_binfo (tree ref, tree known_binfo)
|| BINFO_N_BASE_BINFOS (binfo) == 0)
return NULL_TREE;
- base_binfo = BINFO_BASE_BINFO (binfo, 0);
- if (BINFO_TYPE (base_binfo) != TREE_TYPE (field))
+ base_binfo = get_first_base_binfo_with_virtuals (binfo);
+ if (base_binfo && BINFO_TYPE (base_binfo) != TREE_TYPE (field))
{
tree d_binfo;