http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59414
Bug ID: 59414
Summary: Class array pointers: compile error on valid code
(Different ranks in pointer assignment)
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: antony at cosmologist dot info
Created attachment 31394
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31394&action=edit
OOP module implementing lists of arrays of objects
Compiler errors like
ObjectLists.f90:597.4:
Item => L%ArrayItem(i)
1
Error: Different ranks in pointer assignment at (1)
Code is a class array pointer to a function that returns a class array pointer:
function ArrayItem(L, i) result(P)
Class(TObjectList) :: L
integer, intent(in) :: i
Class(*), pointer :: P(:)
select type (Point=> L%Items(i)%P)
class is (object_array_pointer)
P => Point%P
class default
stop 'TObjectList: item is not array item'
end select
end function ArrayItem
...
class(*), pointer :: Item(:)
Item => L%ArrayItem(i)
Code is valid and works with the Intel compiler. Complete generic list module
attached (from the widely-used but currently not gfortran-compiling CosmoMC
parameter estimation package).