gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1610 Posts in 533 Topics by 777 Members - Latest Member: machleid October 01, 2022, 03:12:43 AM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Windows  |  Automatic allocate/reallocate on assignment not implemented?
gfx
gfxgfx
 

Author Topic: Automatic allocate/reallocate on assignment not implemented?  (Read 522 times)

mecej4

  • Jr. Member
  • **
  • Posts: 76
Automatic allocate/reallocate on assignment not implemented?
« on: March 26, 2022, 08:48:05 PM »
If V is declared to be an allocatable array of a certain type, in Fortran 2003 and later, execution of the assignment statement V = <expression> causes V to be allocated (if not previously allocated) and deallocation/reallocation (if previously allocated and the shapes do not match). The details are to be found in sections 7.4.1.2 and 7.4.1.3 of the Fortran 2003 standard.


In this context, the test program given below causes a run time error, as shown below after the program text.


Are there any plans to implement the "allocate on assignment" feature in Absoft Fortran? Thanks.

Code: [Select]
program prime_sieve

    implicit none

    integer, parameter :: N = 10000, rtN = 100
    integer            :: i, j
    integer, allocatable :: multiples(:)

    multiples = [(( i*j, i=j,N/j,2), j=3,rtN,2)]  ! allocate on assignment

    print '(A,I5,A,I7)','size(multiples) = ',size(multiples)

end program prime_sieve


Code: [Select]
? FORTRAN Runtime Error:
? Reference to  an unallocated allocatable array  MULTIPLES
? File prmabs.f90; Line 9

« Last Edit: March 26, 2022, 08:53:46 PM by mecej4 »

Absoft User Forum  |  Support  |  Windows  |  Automatic allocate/reallocate on assignment not implemented?
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!