- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Fortran !
Here a possible bug with intel compilers (both Windows and Linux OS)
I don't see previous post for this problem but sorry in the converse case.
It involves :
1) TRANSPOSE(RESHAPE(...)) (yes, why not !)
2) Fortran 2003/2008 (re)allocatation feature
What do you think about this ?
Bernard
=================================================================
With ifort 14.0.0074.11 on windows 8 (via visual studio 2012)
V(6)=[1,2,3,4,5,6]
1 2 3 4 5 6
D = RESHAPE(V,[3,2])
1 2 3 4 5 6
E = TRANSPOSE( RESHAPE(V,[3,2]) ) in one step :
WRONG (E has not the right shape ...)
3 2 | 2 3
1 4 -858993460 2 5 -858993460
F = TRANSPOSE(D) with D = RESHAPE(V,[3,2]) in two steps : Ok
2 3
1 4 2 5 3 6
G = RESHAPE( V, Shape=[2,3] , Order=[2,1] ) in one step
with keyword order of RESHAPE : Ok
2 3
1 4 2 5 3 6
==================================================================
With ifort 14.0.0 (20130728) on Linux (ifort with -assume realloc !!)
V(6)=[1,2,3,4,5,6]
1 2 3 4 5 6
D = RESHAPE(V,[3,2])
1 2 3 4 5 6
E = TRANSPOSE( RESHAPE(V,[3,2]) ) in one step :
WRONG (E has not the right shape ...)
3 2 | 2 3
1 4 18 2 5 0
F = TRANSPOSE(D) with D = RESHAPE(V,[3,2]) in two steps : Ok
2 3
1 4 2 5 3 6
G = RESHAPE( V, Shape=[2,3] , Order=[2,1] ) in one step
with keyworf order of RESHAPE : Ok
2 3
1 4 2 5 3 6
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please reattach your test case - something went wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know if i succeed
Here the text of the test :
program test
!ifort test.f90 -assume realloc_lhs
integer, Dimension(:,:), Allocatable :: C, D, E, F, G
integer, Dimension(6) :: V = [1,2,3,4,5,6]
Write(*,*) 'V(6)=[1,2,3,4,5,6]'
Write(*,*) V
Write(*,*)
!
D = RESHAPE(V,[3,2])
Write(*,*) " D = RESHAPE(V,[3,2]) "
Write(*,*) D
Write(*,*)
!
E = TRANSPOSE( RESHAPE(V,[3,2]) )
Write(*,*) " E = TRANSPOSE( RESHAPE(V,[3,2]) ) in one step : "
Write(*,*) " WRONG (E has not the right shape ...) "
Write(*,*) SHAPE(E), ' | ', SHAPE( TRANSPOSE( RESHAPE(V,[3,2]) ) ) ! very curious
Write(*,*) E
Write(*,*)
!
F = TRANSPOSE(D)
Write(*,*) " F = TRANSPOSE(D) with D = RESHAPE(V,[3,2]) in two steps : Ok "
Write(*,*) SHAPE(F)
Write(*,*) F
Write(*,*)
!
G = RESHAPE( V, Shape=[2,3] , Order=[2,1] )
Write(*,*) " G = RESHAPE( V, Shape=[2,3] , Order=[2,1] ) in one step "
Write(*,*) " with keyword order of RESHAPE : Ok "
Write(*,*) SHAPE(G)
Write(*,*) G
Write(*,*)
end program test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, yes, with ifort version 14.0.0.080 Build 20130728, the statement
[fortran]
E = TRANSPOSE( RESHAPE(V,[3,2]) )
[/fortran]
produces incorrect results (moreover dependent on the level of optimization)...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can reproduce this in 14.0, but not in our next-release development stream. I have asked the developers to see if an explicit fix for this was made and if it could be added to 14.0. Issue ID is DPD200250177.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The developers identified the fix and said it will go into Update 2, planned for January.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page