Comment #3 on issue 20 by
omar.aw...@gmail.com: analyze() breaks when
oh.. hold on... i figured it out.. the assertion error happens actually not
because of multiple USEs but only
because the array is defined in a derived type defintion.
Here is a little example:
-----
MODULE test
TYPE t
integer, dimension(:,:), pointer :: a
END TYPE t
END MODULE test
-----
I have fixed the bug, see the diff in the block_statements.py file. The
original code calls first
BeginStatement.analyze(self) on the Type instance, which will call in turn
the analyze function on all elements
of content in this instance. But after analyzing the elements of spec the
code iterates again over content,
which causes the assertion failure. This assertion is only checked when the
field in the derived type is an array
(i.e. has the dimension keyword) So we either have to remove this assertion
or move it to another place in the
update routine where it would be checked for all variables, not only arrays.
I atteched a diff with a couple more changes, I caught 1 or 2 other things
that I think are bugs.
After applying those patches I still see one possible problem. Even though
the parser seems to be handling it
correctly, I still think that if a module A in used in modules B and C, and
both B and C are included in D, then
A is loaded twice.. that could be avoided, right? I've attached an
example.. if you read, parse and analyze
testd.f90 you'll see what I mean..
Thanks!
Attachments:
test.zip 160 bytes
f2py_analyze.diff 1.9 KB