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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to work|                            |6.2.0
            Summary|[7 Regression] Run time     |[7 Regression] [OOP] Run
                   |error: malloc on valid code |time error: double free or
                   |                            |corruption
      Known to fail|                            |7.0

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #5)
> Here is the promised reduced test case, 80 lines, and I do believe that this
> is most likely causing the issues of all our 250 failing tests (hopefully).
> Attached and plain:

I'm afraid this example is invalid, because it accesses element 7 of an array
with size 1, so the runtime error ("free(): invalid pointer") is probably
correct, even though it does not appear with gfortran 6.2.

However, when fixing that (i.e. turning the '7' into a '1'), the runtime error
turns into:

Error in `./a.out': double free or corruption (fasttop): 0x0000000002168ff0 ***


Here is a further reduced test case for that error:

program main_ut
  implicit none

  type :: data_t
     character, dimension(:), allocatable :: name
  end type

  type :: t1_t
     character, dimension(:), allocatable :: name
     class(data_t), pointer :: width_data
  end type

  call evaluator

contains

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

end


As with the previous case, there is no runtime error with gfortran 6.2, so it's
a regression.

Reply via email to