[gfortran] Maybe Fix PR 17077 (Re: Adjustable array segfaults WORKAROUIND)

Canqun Yang canqun@nudt.edu.cn
Fri Aug 20 05:15:00 GMT 2004


Jerry DeLisle <jvdelisle@verizon.net>:

> On Mon, 2004-08-16 at 22:27, Scott Brown wrote:
> > When I use assumed size arrays instead of adjustable
size, it works, no 
> > idea why!  So if I use:
> >     real:: x(:,:)
> > Instead of
> >     real:: x(n,n)
> > 
> > It runs fine.
> > 
> > Scott.
> > 
> > 
> Scott,
> 
> Do you want to post the bug?
> 
> Also I notice that the inner loop gets values assigned
far exceeding the
> value of n.  I put a print statement just after the
x(i,j) assignment
> and the value of j is at 918 before the segfault with
n = 3.
> 
> I have been stripping out my code here and the problem
went away and I
> don't know what I did yet.
> 
> Jerry

 
It seems gfortran use the wrong calling convention for
automatic arrays (Explicity shaped array with
nonconstant bounds. eg. array 'z' defined in subroutine
'foo'). gfortran pass the automatic array through
address ('foo1 (&m, &z)'), but the array reference ('x')
in the callee ('foo1') doesn't match it.

I attached a patch and the revised testcase. Hope it works.
 

2004-08-20  Canqun Yang <canqun@nudt.edu.cn>
                                                       
                        
        PR fortran/17077
        * trans-array.c (gfc_is_automatic_array): New
function.
        (gfc_conv_array_parameter): Don't pass address
of the automatic array.


Canqun Yang

Creative Compiler Research Group.
National University of Defense Technology. P. R. China.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: automatic_array.f90
Type: application/octet-stream
Size: 656 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040820/69f8a30f/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: automatic_array.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040820/69f8a30f/attachment.txt>


More information about the Fortran mailing list