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 fortran/88393] [7/8/9 Regression] [OOP] Segfault with type-bound assignment


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

janus at gcc dot gnu.org changed:

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

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> Looking at this range of commits, I suspect that r241885 is the culprit.


Using -fdump-tree-original to compare the dumps of versions 6 and 7 shows that
the assignment subroutine itself is identical in both, but the dump from v7
contains additional code after the call to 'ass' that is not present in v6.

With v6, the call is translated as follows:

  {
    struct __class_m_T_t class.7;
    struct __class_m_T_t class.8;

    class.7._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T;
    class.7._data = &arr[1].c;
    class.8._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T;
    class.8._data = &arr[0].c;
    ass (&class.7, &class.8);
  }


With v7, it looks much bulkier:

  {
    struct __class_m_T_t class.7;
    struct __class_m_T_t class.8;
    struct t D.3602;
    struct __class_m_T_t * D.3603;
    struct __class_m_T_t D.3604;
    void * restrict D.3605;

    class.7._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T;
    class.7._data = &arr[1].c;
    class.8._vptr = (struct __vtype_m_T * {ref-all}) &__vtab_m_T;
    D.3602 = arr[0].c;
    class.8._data = &D.3602;
    D.3603 = &class.8;
    D.3604 = *D.3603;
    ass (&class.7, D.3603);
    D.3603->_cs_length = D.3604._cs_length;
    if ((void *) D.3604.cs != 0B)
      {
        D.3605 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)
D.3603->_cs_length, 1>);
        D.3603->cs = (character(kind=1)[1:0] *) D.3605;
        __builtin_memcpy (D.3603->cs, D.3604.cs, (unsigned long)
D.3603->_cs_length);
      }
    else
      {
        D.3603->cs = 0B;
      }
    if (D.3603->_data->cs != 0B)
      {
        __builtin_free ((void *) D.3603->_data->cs);
        D.3603->_data->cs = 0B;
      }
  }

Looks like there is some copying and deallocation of the allocatable components
here. Not sure why that would be necessary ...?!?

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