Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

bug(???) in combination of block construct and allocatable derived type

$
0
0

Hi there,

I found a supprising behaviour in this little program:

Module Test_Type
  Type :: TT
    integer, allocatable :: xx(:)
  End type TT
End Module Test_Type
program test
  use Test_Type
  Type(TT), allocatable :: yy
  integer, allocatable :: i,j(:)
  outer:block
    Allocate(yy,j(5),i)
  end block outer
  write(*,*) allocated(yy), allocated(i), allocated(j)
end program test

I would have expected that all variables are still allocated when leaving the block, but this is not the case for "yy". The output of the program was

 F T T

when compiled with ifort 17.05 on linux 4.14.4. Using gfortran 7.2 the output was, as expected,

  T  T  T

The deallocation call must be somewhat a "real" deallocation call, because if yy is a large object from a class with finalizers (e.g. a hugh linked list), the time difference from leaving the block to the program termination is substantial, because the finalizers are called etc.

I can only imagine that this is a bug (but maybe i am wrong).

Any comments??

Cheers


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>