c++/7788: g++-3.2 internal error: Segmentation fault

Pop Sébastian pop@gauvain.u-strasbg.fr
Sun Sep 29 03:09:00 GMT 2002


On Fri, Sep 13, 2002 at 08:39:32PM -0000, nathan@gcc.gnu.org wrote:
> Synopsis: g++-3.2 internal error: Segmentation fault
> 
> State-Changed-From-To: open->analyzed
> State-Changed-By: nathan
> State-Changed-When: Fri Sep 13 13:39:32 2002
> State-Changed-Why:
>     confirmed as a regression
> 
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7788


The problem comes from cp/rtti.c in unemitted_tinfo_decl_p ().

Associated patch with these changes is:

Date: Fri, 21 Jun 2002 12:20:51 +0100
From: Nathan Sidwell <nathan@codesourcery.com>
Organization: Codesourcery LLC
X-Accept-Language: en
To: jason@redhat.com
Cc: gcc-patches@gcc.org
Subject: [C++ PATCH]: Rework typeinfo objects

2002-06-20  Nathan Sidwell  <nathan@codesourcery.com>


  int
! tinfo_decl_p (t, data)
       tree t;
       void *data ATTRIBUTE_UNUSED;
  {
!   return TREE_CODE (t) == VAR_DECL
!          && IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == (t)
!          && TREE_TYPE (t) == tinfo_decl_type
!          && TREE_TYPE (DECL_NAME (t));
  }


Changed into 


  int
! unemitted_tinfo_decl_p (t, data)
       tree t;
       void *data ATTRIBUTE_UNUSED;
  {
!   if (/* It's a var decl */
!       TREE_CODE (t) == VAR_DECL
!       /* whos name points back to itself */
!       && IDENTIFIER_GLOBAL_VALUE (DECL_NAME (t)) == t
!       /* whos name's type is non-null */
!       && TREE_TYPE (DECL_NAME (t))
!       /* and whos type is a struct */
!       && TREE_CODE (TREE_TYPE (t)) == RECORD_TYPE
!       /* with a first field of our pseudo type info */
!       && TREE_TYPE (TYPE_FIELDS (TREE_TYPE (t))) == ti_desc_type_node)
!     return 1;
!   return 0;
  }


I rewrote the condition as :


int
unemitted_tinfo_decl_p (t, data)
     tree t;
     void *data ATTRIBUTE_UNUSED;
{
  /* It's a var decl */
  if (TREE_CODE (t) == VAR_DECL)
    {
      tree dnt = DECL_NAME (t);
      /* whos name points back to itself */
      if (IDENTIFIER_GLOBAL_VALUE (dnt) == t)
        /* whos name's type is non-null */
        if (TREE_TYPE (dnt))
          {
            tree ttt = TREE_TYPE (t);
            /* and whos type is a struct */
            if (TREE_CODE (ttt) == RECORD_TYPE) 
              {
                tree tfttt = TYPE_FIELDS (ttt);
                /* with a first field of our pseudo type info */
=>              if (TREE_TYPE (tfttt) == ti_desc_type_node)
                  return 1;
              }
          }
    }
  return 0;
}



The problem is here => since tfttt is NULL in this bug-report example.
Nathan could you review this patch and the associated bug-report please?

Thanks, 
Sebastian



More information about the Gcc-bugs mailing list