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

--- Comment #1 from Bálint Aradi <baradi09 at gmail dot com> ---
# An even simpler, but probably strongly related scenario also causes a
leakage:

program bugdemo_app
  use bugdemo
  implicit none

  type :: wrapper
    integer, allocatable :: item
  end type wrapper

  type(wrapper), pointer :: array(:)
  allocate(array(1))
  array(1)%item = 42
  deallocate(array)

end program bugdemo_app


# Compiling

gfortran -Og -g3 -fsanitize=address ~/ramdisk/bugdemo.f90

# Obtained result

> ./a.out
Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f069cab1cbc in malloc
../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x560390af559d in bugdemo_app [...]/bugdemo.f90:18

SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).

Reply via email to