This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran, PR44672, v9] [F08] ALLOCATE with SOURCE and no array-spec
- From: Damian Rouson <damian at sourceryinstitute dot org>
- To: Andre Vehreschild <vehre at gmx dot de>
- Cc: GCC-Patches-ML <gcc-patches at gcc dot gnu dot org>, GCC-Fortran-ML <fortran at gcc dot gnu dot org>, Clune Tom <Thomas dot L dot Clune at nasa dot gov>
- Date: Mon, 8 Jun 2015 22:17:09 -0700
- Subject: Re: [Patch, fortran, PR44672, v9] [F08] ALLOCATE with SOURCE and no array-spec
- Authentication-results: sourceware.org; auth=none
- References: <20150330194749 dot 18e21169 at vepi2> <20150401151540 dot 4979eb07 at vepi2> <20150402110330 dot 45ad027b at vepi2> <20150423144511 dot 5e7b12c5 at gmx dot de> <20150429172358 dot 03f42041 at gmx dot de> <20150430161742 dot 1273247f at gmx dot de> <20150519122602 dot 028db8d5 at vepi2> <556369B1 dot 8030600 at sfr dot fr> <20150528172958 dot 456eb24d at vepi2> <55675941 dot 2080008 at sfr dot fr> <20150529134603 dot 0dc5abf9 at vepi2> <556DDEDE dot 4000502 at sfr dot fr> <20150603170917 dot 37c58865 at vepi2> <20150605130401 dot 009adf5d at vepi2>
All,
I sincerely hope this patch will hit the trunk soon. There are 9 users on the cc list for this bug so it is clearly of considerable user interest. I was recently informed that the following three-line program does not compile:
$ cat source-allocation.f90
integer, allocatable :: x(:)
allocate(x,source=[1])
end
$ gfortran source-allocation.f90
source-allocation.f90:2:11:
allocate(x,source=[1])
1
Error: Array specification required in ALLOCATE statement at (1)
$ gfortran --version
GNU Fortran (GCC) 6.0.0 20150607 (experimental)
I was heartened to find out from the initial bug report that itâs a Fortran 2008 feature, which makes the behavior somewhat understandable, but itâs a fairly simple use case that I would imagine will be used widely. FYI, the above three-line program compiles and executes cleanly with the NAG, Cray, Intel, and Portland Group compilers.
________________________________
Damian Rouson, Ph.D., P.E.
Founder & President, Sourcery, Inc.
510-600-2992 (mobile)
http://www.sourceryinstitute.org
http://rouson.youcanbook.me
> On Jun 5, 2015, at 4:04 AM, Andre Vehreschild <vehre@gmx.de> wrote:
>
> Hi all,
>
> attached is the most recent version of the patch. It addresses the standard
> violation of allocate(foo, source=[bar(something)]), where foo after the
> allocate was a zero-based array instead of a one-based. Furthermore does this
> patch fix calling _vptr->_copy () routines, which come without an interface
> specification leading to pass all arguments by reference. When copying a
> deferred length string this is hazardous, because a __copy_character_* ()
> routines third and fourth arguments are passed by value. This is fixed by
> simply counting the actual arguments and using pass by value for third and
> fourth to _copy routine.
>
> Bootstraps and regtests ok on x86_64-linux-gnu/f21.
>
> Ok for trunk?
>
> - Andre
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
> <pr44672_9.clog><pr44672_9.patch>