This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran, PR44672, v9] [F08] ALLOCATE with SOURCE and no array-spec


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]