Hi there. I think I found a compiler bug, perhaps you can confirm. I am using PGI Workstation 13.4, and I’m compiling with the pgfortran program.
I made a simple testing class diagram which exercised most of the functionality I would expect to use, just to learn. (Class diagram here: https://collab.firelab.org/software/projects/orchidee/wiki/Object_Oriented_FORTRAN)
The complete implementation is on github, here: GitHub - bnordgren/oo-fortran-test: Repository to test out Fortran 2003/2008 object oriented features
The part that concerns me is when I try to extend an abstract class to make a concrete class:
type, extends(AbstractCellIterator) :: RowFirstCellIterator
private
contains
procedure :: hasNext => hasnext_rowfirst
procedure :: next => next_rowfirst
end type
When I run the code, and step into my iter%next() call, I end up in the function “hasnext_rowfirst” instead of “next_rowfirst”.
Row First Navigation!
=====================
Breakpoint at 0x402AC9, function walk_path, file test_cell_iterator.f03, line 36
#36: if (.not. associated(iter)) then
pgdbg> n
Stopped at 0x402B44, function walk_path, file test_cell_iterator.f03, line 39
#39: do while (iter%hasNext())
pgdbg> n
In hasnext_rowfirst()
Stopped at 0x402B6D, function walk_path, file test_cell_iterator.f03, line 40
#40: print *, "top of loop"
pgdbg> n
top of loop
Stopped at 0x402BD6, function walk_path, file test_cell_iterator.f03, line 41
#41: cur_coord => (iter%next())
pgdbg> step
Stopped at 0x403A60, function hasnext_rowfirst, file cell_iterator.f03, line 147
#147: hasnext_rowfirst = .false.
It’s the last line of that debugger that bugs me. Is this a known bug? Did I do something wrong? Is there a workaround? (BTW-gfortran 4.7 seems to work as expected.)
Also, pgfortran reported a syntax error (and terminated with signal 11) until I made this change in grid_coordinates.f03 (PGI reporting a syntax error in grid coordinate · bnordgren/oo-fortran-test@74aa5f1 · GitHub)