- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I'm getting the famous warning of a temporary array created, forrtl: warning (406): fort: (1): In call to XXXX, an array temporary was created for argument #N. However, I create simple code to mimic the larger code, and I don't get the same warning. See code below. Essentially I'm passing in a subset array into subroutine XXXX, and indexing on the last index, which should give me a contiguous memory chunk. What else could cause this temporary array creation? ifort version 16.0.0
Code:
program testArrayPassSubroutine integer :: sze,i real, dimension(3,3,2) :: arr real, dimension(2,3,3) :: arr2 !do k=1,2 ! do j=1,3 ! do i=1,3 ! arr(i,j,k) = (k-1)*9 + (j-1)*3 + i ! enddo ! enddo !enddo !do k=1,3 ! do j=1,3 ! do i=1,2 ! arr2(i,j,k) = (k-1)*9 + (j-1)*3 + i ! enddo ! enddo !enddo !This is like the original code, which throws the warning(406):...temporary array creation write(*,*) "Test1 start" call test(arr(:,:,1)) write(*,*) "Test1 done" !This is where I would expect a warning(406), and indeed see it write(*,*) "Test2 start" call test(arr2(1,:,:)) write(*,*) "Test2 done" contains subroutine test(a) integer :: i,j real, dimension(3,3) :: a do i=1,3 do j=1,3 a(j,i) = j*i enddo enddo write(*,*) "Array",(a) write(*,*) "" end subroutine test end program testArrayPassSubroutine
Output:
Test1 start
Array 1.000000 2.000000 3.000000 2.000000
4.000000 6.000000 3.000000 6.000000 9.000000
Test1 done
Test2 start
forrtl: warning (406): fort: (1): In call to TEST, an array temporary was created for argument #1
Image PC Routine Line Source
a.out 0000000000403876 Unknown Unknown Unknown
a.out 0000000000400689 MAIN__ 29 testArrayPassSubroutine.F90
a.out 00000000004004AE Unknown Unknown Unknown
a.out 000000000048D9F1 Unknown Unknown Unknown
a.out 0000000000400389 Unknown Unknown Unknown
Array 1.000000 2.000000 3.000000 2.000000
4.000000 6.000000 3.000000 6.000000 9.000000
Test2 done
Link kopiert
- « Vorherige
-
- 1
- 2
- Nächste »
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I expect this problem to be resolved in the next major release (second half of 2016).

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite
- « Vorherige
-
- 1
- 2
- Nächste »