Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
10 Views

ifort 17 automatic allocatio/reallocation bug!!??

Hi,

this code

Program Test
  Integer, allocatable :: a(:), b(:), c(:,:)
  Allocate(a(5),b(5),c(1,5))
  a=0;b=(/1,2,3,4,5/);c=1
  write(*,*) size(a)
  a=c(1,b)
  write(*,*) size(a)
  a=c(1,:)
  write(*,*) size(a)
End Program Test

yields 5 1 5 when compiled with ifort 17, 5 5 5 when compiled with ifort 16. I know that there is no automatic lhs allocation support in 16, but why yields a=c(1,b) a vector of length 1. Am I missing something??

Thanks and best regards

0 Kudos
3 Replies
Highlighted
10 Views

I think this is a copy bug.

b is an array of integers (/1,2,3,4,5/), therefor

c(1,b) is equivalent to
c(1,/1,2,3,4,5/) is equivalent to the contents
c(1,:)=/1,1,1,1,1/

a=c(1,b) should have produced /1,1,1,1,1/

Steve, is this correct??

Jim Dempsey

0 Kudos
Highlighted
10 Views

16.0 did have automatic reallocation, just not on by default. But if it is turned on, you still get 5 5 5 there, which is correct.

c(1,b) is indeed a 5-element array and the size should be 5. We'll look into that. My guess is that the compiler is incorrectly setting up the information passed to the "should I reallocate?" routine.

Jim, you're correct, though May's program doesn't display values so who knows what got copied.

0 Kudos
Highlighted
10 Views

Escalated as issue DPD200415611

0 Kudos