- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code produces unexpected output for type2%intValue. This seems to be the simplest form of the code that produces the issue (the type requires an allocatable class field, and the issue requires an assignment to an "intent(out)" variable). I've tested this in IFX 2024.0.2, 2024.2.1, and 2025.0.0, as well as IFORT 2021.11.0 and 2021.12.0. Code posted below and is included in the attached file. gfortran produces the expected output.
module testMod
type DummyType
end type DummyType
type ParentType
class(DummyType), allocatable :: templateObject
integer :: intValue = 0
end type ParentType
contains
subroutine RunTest(type1)
type(ParentType), intent(out) :: type1
type(ParentType) :: type2
type1%intValue = 1
type2 = type1
print *, 'Type1 intValue=',type1%intValue
print *, 'Type2 intValue=',type2%intValue
end subroutine RunTest
end module testMod
program TestDerivedTypeAssignment
use testMod, only : ParentType, RunTest
type(ParentType) :: type1
call RunTest(type1)
end program TestDerivedTypeAssignment
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note: this also occurs when a variable is assigned to the result of a function (e.g. with a constructor).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your report. I was able to reproduce the incorrect value. I have escalated this issue to compiler engineering.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix will be available in the 2025.1 ifx release.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page