[Bug fortran/79230] [7 Regression] [OOP] Run time error: double free or corruption

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 28 11:47:00 GMT 2017


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

--- Comment #9 from janus at gcc dot gnu.org ---
(In reply to janus from comment #8)
> Or maybe we should rather call the finalization wrapper for the type
> 'data_t'

That's also what's happening to 'par_real' in the following case:


  subroutine evaluator
    class(data_t), allocatable, target :: par_real
    type(t1_t) :: field
    field%width_data => par_real
  end subroutine


as seen in the dump:

      if (par_real._data != 0B)
        {
          if (par_real._vptr->_final != 0B)
            {
              {
                struct array0_data_t desc.6;

                desc.6.dtype = 552;
                desc.6.data = (void * restrict) par_real._data;
                par_real._vptr->_final (&desc.6, par_real._vptr->_size, 0);
              }
            }
          __builtin_free ((void *) par_real._data);
        }

So, yes, that's the way to go also for the 'width_data' component.


More information about the Gcc-bugs mailing list