- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm not sure if the code below is valid, or if it's a compiler bug (or if I've finally gone insane), but it seems that combining derived types keyword initialization with allocatable characters sets a fixed length for all the variables initialized in such way ---i.e., the length of "first" and "second" for the t variable, is always four.
!------------------------------------------------------------------------------
implicit none
type :: myType
character(:), allocatable :: first
character(:), allocatable :: second
end type
type(myType) :: y, t(3)
integer :: i
y = myType(first = 'this', second = 'that')
t = [myType(first = 'those', second = 'not'), &
myType(first = 'a little longer', second = 'the same'), &
myType(first = 'still much longer', second = 'the same')]
do i = 1, SIZE(t)
print '("t(", I0, ")%first = ", A)' , i, t(i)%first
print '("t(", I0, ")%second = ", A)' , i, t(i)%second
enddo
end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reported as issue DPD200148508.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe I'm doing something wrong here, but... With 11.1 Update 5, and the code I provided above, text is still truncated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 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