This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra


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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> Hmm, -compare-debug not working is bad.  Martin, can you have a look?

Well, the C++ front-end crashes when DECL_LANG_SPECIFIC is cleared on
clones.  We started doing this in Jakub's revision r207465 which fixed
PR 60002.  So if this is OK (and since Jason approved of it in that
PR, I assume it is), the front-end needs to be aware of this.  I do
not know it well enough to propose anything more clever than the
following (so far untested) patch.  However, DECL_LANG_SPECIFIC is
accessed by many macros in cp-tree.h so issues like these are likely
to continue popping up.


diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 424b26c..cc77d8f 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -775,7 +775,13 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
     return 0;

   if (DECL_DECLARES_FUNCTION_P (scope))
-    befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
+    {
+      if (DECL_ABSTRACT_ORIGIN (scope))
+       befriending_classes = DECL_BEFRIENDING_CLASSES
+         (DECL_ABSTRACT_ORIGIN (scope));
+      else
+       befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
+    }
   else if (TYPE_P (scope))
     befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope);
   else
@@ -800,6 +806,9 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
          && friend_accessible_p (DECL_CONTEXT (scope), decl, binfo))
        return 1;

+      if (DECL_ABSTRACT_ORIGIN (scope))
+       scope = DECL_ABSTRACT_ORIGIN (scope);
+      
       /* Or an instantiation of something which is a friend.  */
       if (DECL_TEMPLATE_INFO (scope))
        {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]