- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Hi there,
the code below shows a different behaviour for allocatable scalar characters vs allocatable integer arrays:
Program Test Implicit None Character(:), allocatable :: csa,csb integer, allocatable :: iva(:), ivb(:) write(*,*) "character scalar" write(*,*) allocated(csa), allocated(csb) csb=csa write(*,*) allocated(csa), allocated(csb) write(*,*) "integer vector" write(*,*) allocated(iva), allocated(ivb) ivb=iva write(*,*) allocated(iva), allocated(ivb) write(*,*) "character scalar allocated" csa="a";deallocate(csb) write(*,*) allocated(csa), allocated(csb) csb=csa write(*,*) allocated(csa), allocated(csb) write(*,*) "integer vector allocated" allocate(iva(5)) write(*,*) allocated(iva), allocated(ivb) ivb=iva write(*,*) allocated(iva), allocated(ivb) End Program Test
The output is:
character scalar F F F T integer vector F F F F character scalar allocated T F T T integer vector allocated T F T T
The result was obtain with ifort 17.0.5.
Any clarification whether this is meant to be or not is appreciated.
Cheers
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
In the first csb=csa, where both csb and csa are initially deallocated, it's incorrect that csb becomes allocated. Since csa is deallocated, csb should remain deallocated. Please report this through the Intel Service Center.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The compiler can do whatever it wants, as the references to unallocated objects in the expressions on the right hand side of the assignment statements are nonconforming.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Ian is correct - I was thinking of a different situation.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
ianh wrote:
The compiler can do whatever it wants, ..
Indeed but glad that Intel Fortran compiler provides the -check run-time error checking facility:
https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-check
that will lead to a run-time error for the instruction corresponding to statement on line 7 in the original post.
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora