Skip to content

Commit 6df2ac2

Browse files
committed
BUG: Fix the order of declaring variables in f2py generated code. The bug was noticable with ifort but not with gfortran.
1 parent 1f2e751 commit 6df2ac2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

numpy/f2py/func2subr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def createfuncwrapper(rout,signature=0):
9090
v['dimension'][i] = dn
9191
rout['args'].extend(extra_args)
9292
need_interface = bool(extra_args)
93-
9493

9594
ret = ['']
9695
def add(line,ret=ret):
@@ -141,10 +140,15 @@ def add(line,ret=ret):
141140
if isscalar(vars[a]):
142141
add(var2fixfortran(vars,a,f90mode=f90mode))
143142
dumped_args.append(a)
143+
for a in args:
144+
if a in dumped_args: continue
145+
if isintent_in(vars[a]):
146+
add(var2fixfortran(vars,a,f90mode=f90mode))
147+
dumped_args.append(a)
144148
for a in args:
145149
if a in dumped_args: continue
146150
add(var2fixfortran(vars,a,f90mode=f90mode))
147-
151+
148152
add(l)
149153

150154
if need_interface:

0 commit comments

Comments
 (0)