This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: allocate with mold
- From: Damian Rouson <damian at sourceryinstitute dot org>
- To: fortran at gcc dot gnu dot org, B Finney <brad dot finney at humboldt dot edu>
- Date: Mon, 22 Aug 2016 22:32:45 -0700
- Subject: Re: allocate with mold
- Authentication-results: sourceware.org; auth=none
- References: <ddb8fbe3-34b1-e805-0ce5-312ef3bb4cbe@gmail.com>
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)