- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please provide a test case for what you are observing? Our internal testing doesn't confirm the behavior you are describing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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