- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
It seems to me that ifort 16.0.3 has some difficulties with optional argument passing, when using the -standard-semantics option. The code below demonstrates the issue. The present() query in the subroutine returns false, although the actual argument is an allocated pointer. Changing the dummy argument to be an assumed-shape array cures the problem, the same way as leaving away the -standard-semantics option does it as well.
Bálint
module bugtestmod implicit none contains subroutine optarg(array) real, intent(in), optional :: array(3,3) print *, 'PRESENT?', present(array) end subroutine optarg end module bugtestmod program bugtest use bugtestmod implicit none real, pointer :: array(:,:) allocate(array(3,3)) array(:,:) = 1.0 call optarg(array) end program bugtest
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very interesting. I can reproduce this and we'll investigate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The specific option that triggers the problem is -fpscomp logicals, which is implied by -standard-semantics. It's not PRESENT that is the issue but rather the argument is being passed incorrectly, causing PRESENT to fail (and also the dummy argument to be unusable.) Why -fpscomp logicals should have such an effect, I have no idea, and I have asked the developers to figure it out. Issue ID is DPD200412406.
If you want a workaround, add -fpscomp nologicals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Indeed an interesting cross-effect. Dear Steve, thank you for your fast response and workaround suggestion.
Bálint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem has been fixed. I think the fix will be in the 17.0 product release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix should also appear in 16.0.4.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page