- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ian is correct - I was thinking of a different situation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page