allocate with mold

Andre Vehreschild vehre@gmx.de
Tue Aug 23 09:17:00 GMT 2016


Hi all,

let me add my knowledge to this, because I have added the Fortran 2003
feature of taking the array specification from the source=/mold=
expression instead of having to give an explicit array specification:

- the feature was added during the for this necessary rework of the
  ALLOCATE() routines in the compiler, which was done for the
  gcc-6-branch,

- porting it back to gcc-5 is not feasible without porting back a major
  part of the code, which would render the gcc-5 release identical to
  the gcc-6 release.

Therefore, IMO is this just not supported in gcc-5 and will not be. If
you need this feature, you will have to take all the benefits of a
gcc-6-series compiler.

Regards,
	Andre

On Mon, 22 Aug 2016 22:32:45 -0700
Damian Rouson <damian@sourceryinstitute.org> wrote:

>  
> I have confirmed that the reported behavior exists in gfortran 5.4.0
> based on the following simplified version of the submitted code:
> 
> integer, allocatable :: b(:)  
> allocate(b,mold=[1])  
> end  
> 
> whereas gfortran 6.1.0 compiles the above code without error. I guess
> the only question is whether this feature can be ported back to the
> GCC 5 branch.  I see no mention of "mold=“ in the GCC 5 series
> release notes at https://gcc.gnu.org/gcc-5/changes.html.
> 
> Damian
> 
> 
> On August 22, 2016 at 11:28:18 AM, B Finney
> (brad.finney@humboldt.edu(mailto:brad.finney@humboldt.edu)) wrote:
> 
> > My understanding (likely wrong) is that the mold= attribute for
> > allocate was available in gfortran from (at least) 5.1. The
> > following program complied with gfortran version 5.3
> >  
> > gcc version 5.3.1 20160301 [gcc-5-branch revision 233849] (SUSE
> > Linux) 
> >  
> > results in an error that suggests mold isn't working?
> >  
> > program allocate_array
> > implicit none
> > integer, dimension(3,2)::a
> > integer, dimension(:,:),allocatable::b
> > a=reshape([1,3,5,2,4,6],[3,2])
> > allocate(b,mold=a)
> > b=a
> > end program allocate_array
> >  
> > allocatearray2.f90:6:11:
> >  
> > allocate(b,mold=a)
> > 1
> > Error: Array specification required in ALLOCATE statement at (1)  
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 



More information about the Fortran mailing list