- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The following code creates wrong outputs.
! Compilation & excecution: ifort main.f90 ; ./a.out Module Universal_Class implicit none Type ,abstract :: Universal_Type End Type End Module Module Structure_Class use Universal_Class ,only: Universal_Type implicit none Type ,extends(Universal_Type) :: Structure_Type character(6) :: Name = "Empty " integer ,dimension(1) :: ivar = [0] End Type End Module Program Main use Structure_Class ,only: Structure_Type implicit none type(Structure_Type) ,parameter :: Svar = Structure_Type( Name="Filled",ivar=[1] ) write(*,"(' ',a15,3x,a15)") 'Found', 'Expected' write(*,"(' ',a15,3x,a15)") '-----', '-----' write(*,"(' Svar%Name = ',a15,3x,a15)") Svar%Name, 'Filled' write(*,"(' Svar%ivar = ',i15,3x,i15)") Svar%ivar, 1 End Program
The outputs are:
Found Expected ----- ----- Svar%Name = Filled Filled Svar%ivar = 256 1
The correct outputs are obtained if either one of the following modifications is done
- the order of the components inside the "Structure_Type" derived-type are changed
- the inheritance is removed
I'v only tested the code with ifort version 15.0.6.
Thanks for investigating.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, this is still reproducible in 16.0.2. I find that the problem also goes away if Svar is a variable and not a PARAMETER. Escalated as issue DPD200382227.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect this problem to be fixed in the 17.0 compiler 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