- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello all,
In the following code two derived types, t1,t2 are defined and two functions whose arguments are of type t1, and output of type t2, an elemental and a "classic one". When the elemental is used wrong results are produced if t1 is defined as a class array. The code follows, along with correct and wrong results. Did something change about the class keyword from the previous version? Thank you!
module type_funs type t1 integer :: i end type t1 type t2 integer :: i end type t2 type(t1) :: t1_start = t1(0) contains type(t2) elemental function bin_op(this,that) result(res) type(t1), intent(in) :: this, that res%i=this%i-that%i end function bin_op function bin_op_arr(this,that) result(res) type(t1), dimension(:), intent(in) :: this type(t1), intent(in) :: that type(t2), dimension(size(this)) :: res res%i=this%i-that%i end function bin_op_arr end module type_funs program test_funs use type_funs implicit none ! this produces wrong results class(t1), dimension(:), allocatable :: t1arr ! this produces correct results !type(t1), dimension(:), allocatable :: t1arr allocate(t1arr(10)) t1arr%i=[1:10] print *, bin_op(t1arr,t1_start) print *, bin_op_arr(t1arr,t1_start) end program test_funs
correct result
1 2 3 4 5 6
7 8 9 10
1 2 3 4 5 6
7 8 9 10
wrong result
1 1 1 1 1 1
1 1 1 1
1 2 3 4 5 6
7 8 9 10
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
The test case produces the incorrect results for me going back as far as the 13.1 compilers. Which compiler did you find produced the correct results?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Thanks for the comment!!! I checked again and the previous version I used, 14.0.3, produces the incorrect result. I must had mistakenly compiled and run the code version with the type declaration while thinking it was the class declaration. I am sorry.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Thank you FortranFan for that note.
Thank you for double-checking the reproducer with your previous version. I reported this issue to Development (see internal tracking id below) and will keep you updated on what I hear from them following their further investigation.
(Internal tracking id: DPD200362027)
(Resolution Update on 09/12/2015): This defect is fixed in the Intel® Parallel Studio XE 2016 Release (2016.0.109 - Linux)
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Development has targeted the fix for this issue to the next major release later next year. I will update again when the release containing this fix is available
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I confirmed the associated fix for this issue in the Intel® Parallel Studio XE 2016 Release (Version 16.0.0.109 Build 20150815) available from the Intel® Software Development Products Registration Center (IRC).
