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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-16
          Component|rtl-optimization            |fortran
     Ever confirmed|0                           |1

--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
If I comment the line

  Deallocate (t)

the test compiled with -fsanitize=address runs without error. This is also the
case for the following variant

Program main
  Implicit None
  Type :: t1
  End Type
  Type, Extends (t1) :: t2
    Integer, Allocatable :: i
  End Type
  Type, Extends (t2) :: t3
    Integer, Allocatable :: j
  End Type
  Class (t1), Allocatable :: t
  Allocate (t3 :: t)
  if (allocated(t)) then
    print *,"allocated!"
    select type (t)
      type is (t1)
        print *, "type is t1"
      type is (t2)
        print *, "type is t2"
      type is (t3)
        print *, "type is t3"
        t%i = 42
        t%j = 99
        print *, t%i, t%j
        Deallocate (t%i, t%j)
    end select
!    deallocate (t)
  else
    call abort ()
  end if
End

which outputs at run time

 allocated!
 type is t3
          42          99

Reply via email to