- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
If a derived type a has an allocatable component b, and b also has an allocatable component c, then allocated(a%b%c) with IFORT returns .TRUE. if either b or c is not allocated. In IFX, it fails if b is not allocated. I suspect its closer to the standard now. But now I have to check each in turn and because Fortran does not shortcut the logical expressions once one fails, we have to now use separate if statements to replicate the old behaviour.
if (allocated(a%b)) then
if (allocated(a%b%c)) then
...
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Can you please provide a test case for what you are observing? Our internal testing doesn't confirm the behavior you are describing.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hm, you are correct, it fails for both compilers with my reproducer. My actual code had been working. Can you try an older compiler? Here is the reproducer:
module mod1
implicit none
type c
integer dummy
end type
type b
type(c), allocatable :: y
end type
type a
type(b), allocatable :: x
end type
end module
program test
use mod1
implicit none
type(a) v
print *, allocated(v%x%y)
pause
end
