<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic growing dynamically an allocatable array of derived data; in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213259#M152028</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question about increasing the size of an allocatable array of a derived data, with&lt;/P&gt;
&lt;P&gt;the command:&lt;/P&gt;
&lt;P&gt;a%b =[a%b , element_b]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The specific example is exemplified in the code below.&lt;/P&gt;
&lt;P&gt;-----&lt;/P&gt;
&lt;P&gt;Basically , in the example below, I try to increase the array rn%word dynamically via&lt;/P&gt;
&lt;P&gt;rn%word = [ rn%word&amp;nbsp; , word ]&lt;/P&gt;
&lt;P&gt;however, as the grows to e.g. rn%word(4),&amp;nbsp;&amp;nbsp; rn%word(5) , the previously assigned&amp;nbsp; value of rn%word(2) or rn%word(3) became incorrect. (as if they are overwritten)&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;Any hints why rn%word(2:3)%s became incorrect after the array rn%words&amp;nbsp; grows to 4,5 elements ?&lt;/P&gt;
&lt;P&gt;Is the operator [ ] not defined for arrays of derived data?&lt;/P&gt;
&lt;P&gt;-----&lt;/P&gt;
&lt;P&gt;module hpp_string&lt;BR /&gt;type string&lt;BR /&gt;character(:), allocatable :: s&lt;BR /&gt;end type string&lt;BR /&gt;!save&lt;BR /&gt;end module hpp_string&lt;/P&gt;
&lt;P&gt;module dbg_dbg&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;type dbg_object&lt;BR /&gt;type(string), allocatable :: words(:)&lt;BR /&gt;! integer :: io ! etc&lt;BR /&gt;end type dbg_object&lt;BR /&gt;!save&lt;BR /&gt;end module dbg_dbg&lt;/P&gt;
&lt;P&gt;program m1&lt;BR /&gt;use dbg_dbg , only : dbg_object&lt;BR /&gt;use hpp_string , only : string&lt;BR /&gt;implicit none&lt;BR /&gt;integer i,j,k&lt;BR /&gt;type (dbg_object) :: rn&lt;BR /&gt;type (string) , allocatable :: test(:), pd_reference(:)&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;! rn%words(i) = pd_reference(i)&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;print*,size(rn%words),'++++++',rn%words(size(rn%words))%s&lt;BR /&gt;enddo&lt;BR /&gt;!rn%words(2)=pd_reference(2)&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s, ' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;print*,'-------------------'&lt;/P&gt;
&lt;P&gt;! 2nd pass; repeat above ; ,rn%words(2:3)%s&amp;nbsp; gets overwritten &lt;BR /&gt;read(*,*)&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;! 3rn pass; repeat above&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;read(*,*)&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddoend program m1&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 22:08:35 GMT</pubDate>
    <dc:creator>vjenel</dc:creator>
    <dc:date>2020-09-28T22:08:35Z</dc:date>
    <item>
      <title>growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213259#M152028</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question about increasing the size of an allocatable array of a derived data, with&lt;/P&gt;
&lt;P&gt;the command:&lt;/P&gt;
&lt;P&gt;a%b =[a%b , element_b]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The specific example is exemplified in the code below.&lt;/P&gt;
&lt;P&gt;-----&lt;/P&gt;
&lt;P&gt;Basically , in the example below, I try to increase the array rn%word dynamically via&lt;/P&gt;
&lt;P&gt;rn%word = [ rn%word&amp;nbsp; , word ]&lt;/P&gt;
&lt;P&gt;however, as the grows to e.g. rn%word(4),&amp;nbsp;&amp;nbsp; rn%word(5) , the previously assigned&amp;nbsp; value of rn%word(2) or rn%word(3) became incorrect. (as if they are overwritten)&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;Any hints why rn%word(2:3)%s became incorrect after the array rn%words&amp;nbsp; grows to 4,5 elements ?&lt;/P&gt;
&lt;P&gt;Is the operator [ ] not defined for arrays of derived data?&lt;/P&gt;
&lt;P&gt;-----&lt;/P&gt;
&lt;P&gt;module hpp_string&lt;BR /&gt;type string&lt;BR /&gt;character(:), allocatable :: s&lt;BR /&gt;end type string&lt;BR /&gt;!save&lt;BR /&gt;end module hpp_string&lt;/P&gt;
&lt;P&gt;module dbg_dbg&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;type dbg_object&lt;BR /&gt;type(string), allocatable :: words(:)&lt;BR /&gt;! integer :: io ! etc&lt;BR /&gt;end type dbg_object&lt;BR /&gt;!save&lt;BR /&gt;end module dbg_dbg&lt;/P&gt;
&lt;P&gt;program m1&lt;BR /&gt;use dbg_dbg , only : dbg_object&lt;BR /&gt;use hpp_string , only : string&lt;BR /&gt;implicit none&lt;BR /&gt;integer i,j,k&lt;BR /&gt;type (dbg_object) :: rn&lt;BR /&gt;type (string) , allocatable :: test(:), pd_reference(:)&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;! rn%words(i) = pd_reference(i)&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;print*,size(rn%words),'++++++',rn%words(size(rn%words))%s&lt;BR /&gt;enddo&lt;BR /&gt;!rn%words(2)=pd_reference(2)&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s, ' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;print*,'-------------------'&lt;/P&gt;
&lt;P&gt;! 2nd pass; repeat above ; ,rn%words(2:3)%s&amp;nbsp; gets overwritten &lt;BR /&gt;read(*,*)&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;! 3rn pass; repeat above&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;read(*,*)&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddoend program m1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 22:08:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213259#M152028</guid>
      <dc:creator>vjenel</dc:creator>
      <dc:date>2020-09-28T22:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213261#M152029</link>
      <description>&lt;P&gt;At a first glance it seems that&amp;nbsp; "&lt;SPAN&gt;do i = 1, size(pd_reference)" is used when pd_reference is unallocated which would give an error, so I am thinking the code as pasted here is not the real code.... Maybe I am reading that wrong but if not it is not reasonable to try to draw any conclusion from the code that follows.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From earlier we have&amp;nbsp;a%b =[a%b , element_b] I am not sure that is legal but I am guessing the compiler will need to create a temp and messes up. As a matter of interest does&amp;nbsp;a%b =[a%b(1:n) , element_b] work any better?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 22:37:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213261#M152029</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-28T22:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213274#M152031</link>
      <description>&lt;P&gt;yes, you are right, I copy-paste incomplete (skipped a few lines), thanks for spotting it . Sorry about that.&lt;/P&gt;
&lt;P&gt;I skipped to copy-paste this code sequence which allocated and initialized&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;allocate(pd_reference(3))&lt;BR /&gt;pd_reference(1)%s = '&amp;amp;id'&lt;BR /&gt;pd_reference(2)%s = '&amp;amp;234name'&lt;BR /&gt;pd_reference(3)%s = '&amp;amp;Nxyz'&lt;/P&gt;
&lt;P&gt;allocate(rn%words(0),test(0))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, the complete code is paste below.&lt;/P&gt;
&lt;P&gt;The ifort produces this output:&lt;/P&gt;
&lt;P&gt;1 ++++++&amp;amp;id&lt;BR /&gt;2 ++++++&amp;amp;234name&lt;BR /&gt;3 ++++++&amp;amp;Nxyz&lt;BR /&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt;&amp;amp;id4name &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;-------------------&lt;/P&gt;
&lt;P&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt; &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;id4n &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;4 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;5 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;6 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;-------------------&lt;/P&gt;
&lt;P&gt;-------------------&lt;BR /&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt; &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;id4n &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;4 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;5 &amp;gt;&amp;amp;id4n &amp;gt; &amp;amp;234name&lt;BR /&gt;6 &amp;gt;&amp;amp;id4n &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;7 &amp;gt; &amp;gt; &amp;amp;id&lt;BR /&gt;8 &amp;gt;&amp;amp;id4name &amp;gt; &amp;amp;234name&lt;BR /&gt;9 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;while pgi (18.7) and gfortran (8.1.0) generate the output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 ++++++&amp;amp;id&lt;BR /&gt;2 ++++++&amp;amp;234name&lt;BR /&gt;3 ++++++&amp;amp;Nxyz&lt;BR /&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;-------------------&lt;/P&gt;
&lt;P&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;4 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;5 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;6 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;-------------------&lt;/P&gt;
&lt;P&gt;-------------------&lt;BR /&gt;1 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;2 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;3 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;4 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;5 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;6 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;BR /&gt;7 &amp;gt;&amp;amp;id &amp;gt; &amp;amp;id&lt;BR /&gt;8 &amp;gt;&amp;amp;234name &amp;gt; &amp;amp;234name&lt;BR /&gt;9 &amp;gt;&amp;amp;Nxyz &amp;gt; &amp;amp;Nxyz&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;Basically the word in the middle (between "&amp;gt;" ...&amp;nbsp; "&amp;gt;" ) gets overwritten.&lt;/P&gt;
&lt;P&gt;The complete code is this:&lt;/P&gt;
&lt;P&gt;module hpp_string&lt;BR /&gt;type string&lt;BR /&gt;character(:), allocatable :: s&lt;BR /&gt;end type string&lt;BR /&gt;!save&lt;BR /&gt;end module hpp_string&lt;/P&gt;
&lt;P&gt;module dbg_dbg&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;type dbg_object&lt;BR /&gt;type(string), allocatable :: words(:)&lt;BR /&gt;! integer :: io ! etc&lt;BR /&gt;end type dbg_object&lt;BR /&gt;!save&lt;BR /&gt;end module dbg_dbg&lt;/P&gt;
&lt;P&gt;program m1&lt;BR /&gt;use dbg_dbg , only : dbg_object&lt;BR /&gt;use hpp_string , only : string&lt;BR /&gt;implicit none&lt;BR /&gt;integer i,j,k&lt;BR /&gt;type (dbg_object) :: rn&lt;BR /&gt;type (string) , allocatable :: test(:), pd_reference(:)&lt;/P&gt;
&lt;P&gt;allocate(pd_reference(3))&lt;BR /&gt;pd_reference(1)%s = '&amp;amp;id'&lt;BR /&gt;pd_reference(2)%s = '&amp;amp;234name'&lt;BR /&gt;pd_reference(3)%s = '&amp;amp;Nxyz'&lt;/P&gt;
&lt;P&gt;allocate(rn%words(0),test(0))&lt;/P&gt;
&lt;P&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;! rn%words(i) = pd_reference(i)&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;print*,size(rn%words),'++++++',rn%words(size(rn%words))%s&lt;BR /&gt;enddo&lt;BR /&gt;!rn%words(2)=pd_reference(2)&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s, ' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;print*,'-------------------'&lt;/P&gt;
&lt;P&gt;! repeat above&lt;BR /&gt;read(*,*)&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(pd_reference)&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;test=[test, pd_reference(i) ]&lt;BR /&gt;enddo&lt;BR /&gt;read(*,*)&lt;BR /&gt;print*,'-------------------'&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;',rn%words(i)%s,' &amp;gt; ',test(i)%s&lt;BR /&gt;enddo&lt;/P&gt;
&lt;P&gt;stop&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;end program m1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 23:41:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213274#M152031</guid>
      <dc:creator>vjenel</dc:creator>
      <dc:date>2020-09-28T23:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213394#M152032</link>
      <description>&lt;P&gt;OK, I see the same problem when I run your code. I think that is a bug, I suggest you file a ticket on that . On a practical note is see that the "test" variable works OK as does the code below:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;    do i = 1, size(pd_reference)
        !rn%words = [ rn%words, pd_reference(i) ]
        ! rn%words(i) = pd_reference(i)
        test=[test, pd_reference(i) ]
        rn%words = test
        print*,size(rn%words),'++++++',rn%words(size(rn%words))%s
    enddo&lt;/LI-CODE&gt;
&lt;P&gt;I do not think your code is a good design. What I think will happen is the compiler will construct the array as new (a temp in effect) copy copying all the data it will then deallocate the old one and point at the new data , effectively a move_alloc. If you do this many times increasing by one it is very inefficient.&amp;nbsp; If you add a lot of data better to guess a large-ish size to allocate and then add data. At the end do a copy / move_alloc to resize to the correct size or you if you run out of space (due to a poor size guess) do a copy move_alloc to increase the allocation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:13:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213394#M152032</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-29T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213514#M152047</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For small lists read once, buffering wont make much difference , but for large lists i buffer in static arrays of 100..1000..etc. elements and then append whole chunk (like in subroutine grow_c1_b_larger_buffer in attached m1.f90 ; a move_alloc would save some time I would guess).&lt;/P&gt;
&lt;P&gt;However, trying to append an array chunk e.g. [e1,e2,e3] utilizing a=[a ,[e1,e2,e2] ] still generated&lt;BR /&gt;unexpected results for lists of characters, as exemplified in the attached code m1.f90 for rn_biss and cc1_biss.&lt;/P&gt;
&lt;P&gt;The same unexpected behavior happened with list of static character(1) ( the type "c1list" in m1.f90).&lt;/P&gt;
&lt;P&gt;Yet, utilizing similar derived data structure of lists having integer and real*8 instead of characters&lt;BR /&gt;(as in the types "list" and "rlist" in m1.f90) behaves as expected and does not overwrite while growing the array with [ , ].&lt;/P&gt;
&lt;P&gt;Replacing the operator [ , ] with my own coded subroutines (like the "grow" in m1.f90)&lt;BR /&gt;generated the expected/correct answer.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;------&lt;/P&gt;
&lt;P&gt;Thanks a lot for the fast answer(s).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;----&lt;/P&gt;
&lt;P&gt;[code]&lt;/P&gt;
&lt;P&gt;module hpp_string&lt;BR /&gt;type string&lt;BR /&gt;character(:), allocatable :: s&lt;BR /&gt;end type string&lt;BR /&gt;end module hpp_string&lt;/P&gt;
&lt;P&gt;module hpp_1ch&lt;BR /&gt;type c1list&lt;BR /&gt;character(1), allocatable :: c1(:)&lt;BR /&gt;end type c1list&lt;BR /&gt;end module hpp_1ch&lt;/P&gt;
&lt;P&gt;module hpp_ilist&lt;BR /&gt;type list&lt;BR /&gt;integer, allocatable :: i(:)&lt;BR /&gt;end type list&lt;BR /&gt;end module hpp_ilist&lt;/P&gt;
&lt;P&gt;module hpp_rlist&lt;BR /&gt;type rlist&lt;BR /&gt;real*8, allocatable :: r(:)&lt;BR /&gt;end type rlist&lt;BR /&gt;end module hpp_rlist&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;module dbg_dbg&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;use hpp_ilist, only : list&lt;BR /&gt;use hpp_rlist, only : rlist&lt;BR /&gt;use hpp_1ch , only : c1list&lt;BR /&gt;type dbg_object&lt;BR /&gt;type(string), allocatable :: words(:)&lt;BR /&gt;end type dbg_object&lt;/P&gt;
&lt;P&gt;type idbg_object&lt;BR /&gt;type(list), allocatable :: iw(:)&lt;BR /&gt;end type idbg_object&lt;/P&gt;
&lt;P&gt;type c1dbg_object&lt;BR /&gt;type(c1list), allocatable :: c1(:)&lt;BR /&gt;end type c1dbg_object&lt;/P&gt;
&lt;P&gt;type rdbg_object&lt;BR /&gt;type(rlist), allocatable :: r8(:)&lt;BR /&gt;end type rdbg_object&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;!save&lt;BR /&gt;end module dbg_dbg&lt;/P&gt;
&lt;P&gt;module opps&lt;BR /&gt;public :: to_char&lt;/P&gt;
&lt;P&gt;interface huh&lt;BR /&gt;module procedure huh0&lt;BR /&gt;module procedure huh1 &lt;BR /&gt;module procedure huh2&lt;BR /&gt;module procedure huh3&lt;BR /&gt;end interface huh&lt;BR /&gt;private :: huh0,huh1,huh2, huh3&lt;/P&gt;
&lt;P&gt;interface to_char&lt;BR /&gt;module procedure to_char_i&lt;BR /&gt;module procedure to_char_r&lt;BR /&gt;end interface to_char&lt;BR /&gt;private :: to_char_i,to_char_r&lt;/P&gt;
&lt;P&gt;interface grow&lt;BR /&gt;module procedure grow_s&lt;BR /&gt;module procedure grow_s_b&lt;BR /&gt;module procedure grow_s_b_larger_buffer&lt;BR /&gt;module procedure grow_c1&lt;BR /&gt;module procedure grow_c1_b&lt;BR /&gt;module procedure grow_c1_b_larger_buffer&lt;BR /&gt;end interface grow&lt;BR /&gt;private:: grow_s,grow_c1,grow_s_b,grow_s_b_larger_buffer,grow_c1_b,grow_c1_b_larger_buffer&lt;/P&gt;
&lt;P&gt;contains&lt;BR /&gt;function to_char_i ( v ) result (u)&lt;BR /&gt;implicit none&lt;BR /&gt;integer, intent(in) :: v(:)&lt;BR /&gt;character(:),allocatable :: u&lt;BR /&gt;character(50) :: ch50&lt;BR /&gt;integer i&lt;BR /&gt;u=""&lt;BR /&gt;do i = 1, size(v)&lt;BR /&gt;ch50=repeat(' ',len(ch50)) ; write(ch50,*) v(i)&lt;BR /&gt;u = u//' '//trim(adjustl(ch50))&lt;BR /&gt;enddo&lt;BR /&gt;u=trim(adjustl(u))&lt;BR /&gt;end function to_char_i&lt;BR /&gt;function to_char_r ( v , fmt) result (u)&lt;BR /&gt;implicit none&lt;BR /&gt;real*8, intent(in) :: v(:)&lt;BR /&gt;character(*),intent(in),optional :: fmt&lt;BR /&gt;character(:),allocatable :: u, fmt_&lt;BR /&gt;character(50) :: ch50&lt;BR /&gt;integer i,ierr,ierr1&lt;BR /&gt;real*8 tmp&lt;BR /&gt;fmt_='*'&lt;BR /&gt;if (present(fmt))fmt_=fmt&lt;BR /&gt;u=""&lt;BR /&gt;do i = 1, size(v)&lt;BR /&gt;ch50=repeat(' ',len(ch50)) ;&lt;BR /&gt;if(fmt_=='*') then &lt;BR /&gt;write(ch50,*) v(i) &lt;BR /&gt;else&lt;BR /&gt;write(ch50,fmt_,iostat=ierr) v(i)&lt;BR /&gt;read(ch50,*,iostat=ierr1) tmp&lt;BR /&gt;if (ierr/=0.or.ierr1/=0.or.index(ch50,'*')&amp;gt;0) then &lt;BR /&gt;ch50=repeat(' ',len(ch50)) ! &lt;BR /&gt;write(ch50,*) v(i)&lt;BR /&gt;endif&lt;BR /&gt;endif&lt;BR /&gt;u = u//' '//trim(adjustl(ch50))&lt;BR /&gt;enddo&lt;BR /&gt;u=trim(adjustl(u))&lt;BR /&gt;end function to_char_r&lt;BR /&gt;subroutine grow_s ( list, one )&lt;BR /&gt;use hpp_string, only : string &lt;BR /&gt;use dbg_dbg, only : dbg_object&lt;BR /&gt;implicit none&lt;BR /&gt;type(dbg_object) :: list&lt;BR /&gt;type(string) , intent(in) :: one&lt;BR /&gt;type(string) ,allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list%words)) then&lt;BR /&gt;allocate(list%words(1)); list%words(1) = one ; &lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list%words, buff)&lt;BR /&gt;allocate(list%words(size(buff)+1))&lt;BR /&gt;list%words( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list%words( 1 + size(buff) ) = one&lt;BR /&gt;endif &lt;BR /&gt;end subroutine grow_s&lt;BR /&gt;subroutine grow_s_b ( list, one )&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;implicit none&lt;BR /&gt;type(string) ,allocatable :: list(:)&lt;BR /&gt;type(string) , intent(in) :: one&lt;BR /&gt;type(string) ,allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list)) then&lt;BR /&gt;allocate(list(1)); list(1) = one ;&lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list, buff)&lt;BR /&gt;allocate(list(size(buff)+1))&lt;BR /&gt;list( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list( 1 + size(buff) ) = one&lt;BR /&gt;endif&lt;BR /&gt;end subroutine grow_s_b&lt;BR /&gt;subroutine grow_s_b_larger_buffer ( list, append_several )&lt;BR /&gt;use hpp_string, only : string&lt;BR /&gt;implicit none&lt;BR /&gt;type(string) ,allocatable :: list(:)&lt;BR /&gt;type(string) , intent(in) :: append_several(:)&lt;BR /&gt;type(string) ,allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list)) then&lt;BR /&gt;allocate(list(size(append_several))); list = append_several ;&lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list, buff)&lt;BR /&gt;allocate(list(size(buff)+size(append_several)))&lt;BR /&gt;list( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list( 1+size(buff) : size(buff)+size(append_several) ) = append_several&lt;BR /&gt;endif&lt;BR /&gt;if(allocated(buff))deallocate(buff)! not necesary &lt;BR /&gt;end subroutine grow_s_b_larger_buffer&lt;/P&gt;
&lt;P&gt;subroutine grow_c1 ( list, one )&lt;BR /&gt;use hpp_1ch, only : c1list&lt;BR /&gt;use dbg_dbg, only : c1dbg_object&lt;BR /&gt;implicit none&lt;BR /&gt;type(c1dbg_object) :: list&lt;BR /&gt;type(c1list) , intent(in) :: one&lt;BR /&gt;type(c1list) ,allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list%c1)) then&lt;BR /&gt;allocate(list%c1(1)); list%c1(1) = one ;&lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list%c1, buff)&lt;BR /&gt;allocate(list%c1(size(buff)+1))&lt;BR /&gt;list%c1( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list%c1( 1 + size(buff) ) = one&lt;BR /&gt;endif&lt;BR /&gt;end subroutine grow_c1&lt;BR /&gt;subroutine grow_c1_b ( list, one )&lt;BR /&gt;use hpp_1ch, only : c1list&lt;BR /&gt;implicit none&lt;BR /&gt;type(c1list) , allocatable :: list(:)&lt;BR /&gt;type(c1list) , intent(in) :: one&lt;BR /&gt;type(c1list) , allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list)) then&lt;BR /&gt;allocate(list(1)); list(1) = one ;&lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list, buff)&lt;BR /&gt;allocate(list(size(buff)+1))&lt;BR /&gt;list( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list( 1 + size(buff) ) = one&lt;BR /&gt;endif&lt;BR /&gt;end subroutine grow_c1_b&lt;BR /&gt;subroutine grow_c1_b_larger_buffer ( list, append_several )&lt;BR /&gt;use hpp_1ch, only : c1list&lt;BR /&gt;implicit none&lt;BR /&gt;type(c1list) ,allocatable :: list(:)&lt;BR /&gt;type(c1list) , intent(in) :: append_several(:)&lt;BR /&gt;type(c1list) ,allocatable :: buff(:)&lt;BR /&gt;if (.not.allocated(list)) then&lt;BR /&gt;allocate(list(size(append_several))); list = append_several ;&lt;BR /&gt;else&lt;BR /&gt;call move_alloc(list, buff)&lt;BR /&gt;allocate(list(size(buff)+size(append_several)))&lt;BR /&gt;list( 1:size(buff) ) = buff ( 1:size(buff) )&lt;BR /&gt;list( 1+size(buff) : size(buff)+size(append_several) ) = append_several&lt;BR /&gt;endif&lt;BR /&gt;if(allocated(buff))deallocate(buff)! not necesary&lt;BR /&gt;end subroutine grow_c1_b_larger_buffer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function huh0 ( u1 , u2 ) result ( u )&lt;BR /&gt;character(*), intent(in) :: u1,u2&lt;BR /&gt;character(:),allocatable :: u &lt;BR /&gt;if (trim(u1)==trim(u2)) then ! trim is not necesary&lt;BR /&gt;u=''&lt;BR /&gt;else&lt;BR /&gt;u = ' ==&amp;gt;&amp;gt; NOT GOOD !!!!!!'&lt;BR /&gt;endif&lt;BR /&gt;end function huh0&lt;BR /&gt;function huh1(u1, u2) result(u)&lt;BR /&gt;character(1), intent(in) :: u1(:)&lt;BR /&gt;character(*), intent(in) :: u2&lt;BR /&gt;character(:),allocatable :: u&lt;BR /&gt;character(:),allocatable :: line&lt;BR /&gt;integer i&lt;BR /&gt;allocate(character(size(u1))::line)&lt;BR /&gt;do i =1, size(u1)&lt;BR /&gt;line(i:i)=u1(i)(1:1)&lt;BR /&gt;enddo&lt;BR /&gt;u = huh0(line, u2)&lt;BR /&gt;end function huh1&lt;BR /&gt;function huh2(u1, u2) result(u)&lt;BR /&gt;character(1), intent(in) :: u2(:)&lt;BR /&gt;character(*), intent(in) :: u1&lt;BR /&gt;character(:),allocatable :: u&lt;BR /&gt;character(:),allocatable :: line&lt;BR /&gt;integer i&lt;BR /&gt;allocate(character(size(u2))::line)&lt;BR /&gt;do i =1, size(u2)&lt;BR /&gt;line(i:i)=u2(i)(1:1)&lt;BR /&gt;enddo&lt;BR /&gt;u = huh0(u1, line)&lt;BR /&gt;end function huh2&lt;BR /&gt;function huh3(u1, u2) result(u)&lt;BR /&gt;character(1), intent(in) :: u1(:),u2(:)&lt;BR /&gt;character(:),allocatable :: u&lt;BR /&gt;character(:),allocatable :: line1,line2&lt;BR /&gt;integer i&lt;BR /&gt;allocate(character(size(u2))::line2)&lt;BR /&gt;allocate(character(size(u1))::line1)&lt;BR /&gt;do i =1, size(u2)&lt;BR /&gt;line2(i:i)=u2(i)(1:1)&lt;BR /&gt;enddo&lt;BR /&gt;do i =1, size(u1)&lt;BR /&gt;line1(i:i)=u1(i)(1:1)&lt;BR /&gt;enddo&lt;BR /&gt;u = huh0(line1, line2)&lt;BR /&gt;end function huh3&lt;BR /&gt;end module opps&lt;/P&gt;
&lt;P&gt;! main code&lt;BR /&gt;program m1&lt;BR /&gt;use dbg_dbg , only : dbg_object, idbg_object,c1dbg_object,rdbg_object&lt;BR /&gt;use hpp_string , only : string &lt;BR /&gt;use hpp_ilist , only : list&lt;BR /&gt;use hpp_1ch , only : c1list&lt;BR /&gt;use hpp_rlist , only : rlist&lt;BR /&gt;use opps , only : to_char, grow, huh&lt;BR /&gt;implicit none&lt;BR /&gt;integer i,j,k, ijk, VARIANT,ierr,N3&lt;BR /&gt;character(32) ch32&lt;BR /&gt;type (dbg_object) :: rn, rn_biss&lt;BR /&gt;type (idbg_object) :: irn&lt;BR /&gt;type (c1dbg_object ) :: cc1 , cc1_biss&lt;BR /&gt;type (rdbg_object) :: rr&lt;BR /&gt;&lt;BR /&gt;type (string) , allocatable :: test(:), pd_reference(:) ! list of allocatable characters&lt;BR /&gt;type( list ) , allocatable :: itest(:), ipd_ref(:) ! list of integer &lt;BR /&gt;type (c1list) , allocatable :: ctest(:), cpd_ref(:) ! list of char(1)&lt;BR /&gt;type (rlist) , allocatable :: rtest(:) , rpd_ref(:) ! list of real*8&lt;/P&gt;
&lt;P&gt;N3=3&lt;BR /&gt;VARIANT = -1 !2 ! 1-2=user defined grow() ; 3+ or &amp;lt;1 = in built [, ] operator&lt;BR /&gt;! i = IARGC() ! &lt;BR /&gt;i = command_argument_count()&lt;BR /&gt;print*,i&lt;BR /&gt;if (i &amp;gt; 0 ) then&lt;BR /&gt;ch32=repeat(' ',len(ch32))&lt;BR /&gt;!call getarg(1, ch32)&lt;BR /&gt;CALL get_command_argument(1, ch32)&lt;BR /&gt;read(ch32,*,iostat=ierr) j&lt;BR /&gt;if (ierr==0)VARIANT = j&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;print*,' ::: with '//to_char((/VARIANT/))//' -&amp;gt; '//lmsg(VARIANT)&lt;/P&gt;
&lt;P&gt;! initialiozations&lt;BR /&gt;allocate(pd_reference(N3),ipd_ref(N3),cpd_ref(N3),rpd_ref(N3))&lt;BR /&gt;pd_reference(1)%s = '&amp;amp;id' ! set up for the list with allocatable chars&lt;BR /&gt;pd_reference(2)%s = '&amp;amp;234name'&lt;BR /&gt;pd_reference(3)%s = '&amp;amp;Nxyz'&lt;BR /&gt;ipd_ref(1)%i = [1,2,3] ! set up for the list with integers&lt;BR /&gt;ipd_ref(2)%i = [5,6,7,8,9,10,11,12]&lt;BR /&gt;ipd_ref(3)%i = [100,101,102,103]&lt;BR /&gt;cpd_ref(1)%c1 = ['&amp;amp;','i','d'] ! set up for the list with chars(1)&lt;BR /&gt;cpd_ref(2)%c1 = ['&amp;amp;','2','3','4','n','a','m','e']&lt;BR /&gt;cpd_ref(3)%c1 = ['&amp;amp;','N','x','y','z']&lt;BR /&gt;rpd_ref(1)%r = [1.0d0,2.0d0,3.0d0] ! set up for the list with integers&lt;BR /&gt;rpd_ref(2)%r = [5.0d0,6.d0,7.0d0,8.0d0,9.0d0,10.0d0,11.0d0,12.0d0]&lt;BR /&gt;rpd_ref(3)%r = [100.0d0,101.0d0,102.0d0,103.0d0]&lt;/P&gt;
&lt;P&gt;!&lt;/P&gt;
&lt;P&gt;allocate(rn%words(0),rn_biss%words(0),test(0),itest(0),ctest(0),rtest(0),irn%iw(0),cc1%c1(0),cc1_biss%c1(0),rr%r8(0))&lt;/P&gt;
&lt;P&gt;do ijk = 1,3&lt;/P&gt;
&lt;P&gt;do i = 1, N3 !size(pd_reference)a&lt;BR /&gt;if (VARIANT == 1) then&lt;BR /&gt;call grow ( rn , pd_reference(i) ) &lt;BR /&gt;call grow ( cc1 , cpd_ref(i) )&lt;BR /&gt;else if (VARIANT == 2 ) then&lt;BR /&gt;call grow ( rn%words , pd_reference(i) )&lt;BR /&gt;call grow ( cc1%c1 , cpd_ref(i) )&lt;BR /&gt;else&lt;BR /&gt;rn%words = [ rn%words, pd_reference(i) ]&lt;BR /&gt;cc1%c1 = [ cc1%c1 , cpd_ref(i) ]&lt;BR /&gt;endif&lt;BR /&gt;irn%iw = [ irn%iw, ipd_ref(i) ] ! integer list within a derived type&lt;BR /&gt;rr%r8 = [ rr%r8 , rpd_ref(i) ] ! real*8 list within a derived type&lt;BR /&gt;test = [ test , pd_reference(i) ] ! string list &lt;BR /&gt;itest = [ itest , ipd_ref(i) ] ! integer list&lt;BR /&gt;ctest = [ ctest , cpd_ref(i) ] ! char(1) list&lt;BR /&gt;rtest = [ rtest , rpd_ref(i) ] ! real*8 list&lt;BR /&gt;if(ijk==1)print*,size(rn%words),'++++++',rn%words(size(rn%words))%s, ' __ ',cc1%c1(size(cc1%c1))%c1 &lt;BR /&gt;enddo&lt;/P&gt;
&lt;P&gt;if (VARIANT == 1.or. VARIANT==2)then ! increasing the list of a larger buffer (3 in this example)&lt;BR /&gt;call grow ( rn_biss%words , pd_reference ) ! buffer more than 1 for efficiency&lt;BR /&gt;call grow ( cc1_biss%c1 , cpd_ref )&lt;BR /&gt;else&lt;BR /&gt;rn_biss%words = [ rn_biss%words , [ pd_reference(1),pd_reference(2),pd_reference(3) ] ]&lt;BR /&gt;cc1_biss%c1 = [ cc1_biss%c1 , [ cpd_ref(1), cpd_ref(2), cpd_ref(3) ] ]&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;call l_print&lt;/P&gt;
&lt;P&gt;print*,' ~~~ Press ENTER to continue ~~~~'&lt;BR /&gt;read(*,*)&lt;/P&gt;
&lt;P&gt;enddo ! ijk&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;contains&lt;BR /&gt;subroutine l_print&lt;BR /&gt;print*,'=================== '//to_char((/ijk/))//' variant = '//to_char((/VARIANT/))//' -&amp;gt; '//lmsg(VARIANT)&lt;BR /&gt;print*,'------------------- strings (allocatable chars) :'&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,' &amp;gt;',rn%words(i)%s, ' &amp;gt; ',test(i)%s, huh(rn%words(i)%s, test(i)%s)&lt;BR /&gt;enddo&lt;BR /&gt;print*,'------------------- allocatable list of static char(1) :'&lt;BR /&gt;do i = 1, size(ctest) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;&amp;gt;',cc1%c1(i)%c1, ' &amp;gt; ',ctest(i)%c1, huh(cc1%c1(i)%c1, test(i)%s)&lt;BR /&gt;enddo&lt;BR /&gt;print*,'------------------- APPEND SEVERAL strings :'&lt;BR /&gt;do i = 1, size(test) !size(rn%words)&lt;BR /&gt;print*,i,' &amp;gt;',rn_biss%words(i)%s, ' &amp;gt; ',test(i)%s, huh(rn_biss%words(i)%s, test(i)%s)&lt;BR /&gt;enddo&lt;BR /&gt;print*,'------------------- APPEND SEVERAL list of static char(1) :'&lt;BR /&gt;do i = 1, size(ctest) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;&amp;gt;',cc1_biss%c1(i)%c1, ' &amp;gt; ',ctest(i)%c1, huh(test(i)%s, cc1_biss%c1(i)%c1)!, test(i)%s)&lt;BR /&gt;enddo&lt;/P&gt;
&lt;P&gt;! skip integer and real*8; verified to be ok.&lt;BR /&gt;if(0==1)then !skip them; &lt;BR /&gt;print*,'------------------- allocatable list of integers :'&lt;BR /&gt;do i = 1, size(itest) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;i&amp;gt;',to_char(irn%iw(i)%i), ' &amp;gt; ',to_char(itest(i)%i)&lt;BR /&gt;enddo&lt;BR /&gt;print*,'------------------- allocatable list of real*8 :'&lt;BR /&gt;do i = 1, size(rtest) !size(rn%words)&lt;BR /&gt;print*,i,'&amp;gt;i&amp;gt;',to_char(rr%r8(i)%r, fmt='(F6.2)'), ' &amp;gt; ',to_char(rtest(i)%r, fmt='(F6.2)' )&lt;BR /&gt;enddo&lt;BR /&gt;endif!&lt;BR /&gt;end subroutine l_print&lt;BR /&gt;&lt;BR /&gt;function lmsg(i_) result (u_)&lt;BR /&gt;integer, intent(in) :: i_&lt;BR /&gt;character(:),allocatable :: u_&lt;BR /&gt;if(i_==1) then &lt;BR /&gt;u_=' with user-defined "grow" method ; passing whole object '&lt;BR /&gt;else if (i_==2) then&lt;BR /&gt;u_=' with user-defined "grow" method ; passing a subset of the object '&lt;BR /&gt;else &lt;BR /&gt;u_ = ' using [ , ]'&lt;BR /&gt;endif&lt;BR /&gt;end function lmsg&lt;BR /&gt;end program m1&lt;/P&gt;
&lt;P&gt;[/code]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:37:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213514#M152047</guid>
      <dc:creator>vjenel</dc:creator>
      <dc:date>2020-09-29T18:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: growing dynamically an allocatable array of derived data;</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213700#M152057</link>
      <description>&lt;P&gt;When positing code there is a ... option on the tool bar which shows more options, The &amp;lt;/&amp;gt; option thus exposed allows you to have a block formatted as Fortran (or other types) which is better to read and stops problems like certain character combinations being converted to imojis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you file ticket of this with a reproducer code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 08:08:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/growing-dynamically-an-allocatable-array-of-derived-data/m-p/1213700#M152057</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-30T08:08:17Z</dc:date>
    </item>
  </channel>
</rss>

