view gcc/testsuite/gfortran.dg/class_allocate_16.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR 59589: [4.9 Regression] [OOP] Memory leak when deallocating polymorphic
!
! Contributed by Rich Townsend <townsend@astro.wisc.edu>

  implicit none

  type :: foo
     real, allocatable :: x(:)
  end type

  type :: bar
     type(foo) :: f
  end type

  class(bar), allocatable :: b

  allocate(bar::b)
  allocate(b%f%x(1000000))
  b%f%x = 1.
  deallocate(b)

end

! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } }