[Bug c++/70205] [4.9/5/6 Regression] ICE on valid code on x86_64-linux-gnu: tree check: expected tree_binfo, have error_mark in add_candidates, at cp/call.c:5283

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 17 14:41:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70205

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
That would suppress the ICE but in turn it would make us silently generate
wrong code since the call to D::f() won't be emitted.

adjust_result_of_qualified_name_lookup() is responsible for clobbering the
BASELINK_BINFO of the function.  This seems to work:

--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1751,9 +1751,11 @@ adjust_result_of_qualified_name_lookup (tree decl,
       if (base && base != error_mark_node)
        {
          BASELINK_ACCESS_BINFO (decl) = base;
-         BASELINK_BINFO (decl)
+         tree decl_binfo
            = lookup_base (base, BINFO_TYPE (BASELINK_BINFO (decl)),
                           ba_unique, NULL, tf_none);
+         if (decl_binfo && decl_binfo != error_mark_node)
+           BASELINK_BINFO (decl) = decl_binfo;
        }
     }


More information about the Gcc-bugs mailing list