RANDOM COLLECTION OF BUGS AND TODO ITEMS FOR GFORTRAN's COARRAYS See also http://users.physik.fu-berlin.de/~tburnus/coarray/README.txt in the sections "STATUS" and "WHAT'S NEXT". * * * Library implementation (todo, implementation details) - http://gcc.gnu.org/wiki/CoarrayLib - http://gcc.gnu.org/ml/fortran/2010-04/msg00168.html - http://gcc.gnu.org/ml/fortran/2011-05/msg00078.html - Status, see: http://users.physik.fu-berlin.de/~tburnus/coarray/README.txt * * * Near term plans - partially done as part of a Google Summer of Code (2011) project, cf. http://gcc.gnu.org/wiki/SummerOfCode#Summer_of_Code_2011_Accepted_GCC_Projects * [FE=lib] Handle deregistering for manual DEALLOCATE - including STAT= support. * [FE=lib] Handle deregistering for automatic deallocate * [FE=single+lib] Fix DT handling, esp. deallocate of components during assignment (i.e. not if coarrays), automatic deallocate for -fcoarray=lib (see also below) Near-term bigger project: * [LIB=MPI] Implement request processing loop and add then support for: - SYNC ALL/IMAGES - Finalise/sync-all message processing - ERROR STOP: Fail more gracefully Follow up: * [FE=lib] First data-transfer support e.g. assigning to a remote coarray (scalar LHS) such as coarray[4]%element(1)%a = 7 On going: * Improve documentation * Add general internal documentation regarding hidden arguments (strings, coarrays), assembler-name convention, array descriptor format, ... * * * --------------------------- Component assignment bug: No reallocate when assigning to coarray components. Preliminary draft, see: http://users.physik.fu-berlin.de/~tburnus/coarray/new/caf_assign.diff Example: type t integer, allocatable :: A[:] end type t type(t) :: x, y x = y Is currently handled as: D.1564 = *x; *x = *y; if ((void *) y->a != 0B) x->a = __builtin_malloc (4); __builtin_memcpy (x->a, y->a, 4); else x->a = 0B; if (D.1564.a != 0B) __builtin_free ((void *) D.1564.a); For alloc coarray components, the proper handling is: *x = *y; if ((void *) y->a != 0B) __builtin_memcpy (x->a, y->a, 4); else x->a = 0B; where the last step is superfluous. And with -fcheck=... D.1564 = *x; *x = *y; if ((D.1564.a == NULL && y->a != NULL) || (D.1564.a != NULL && y->a == NULL)) run_time_error For nonscalars, one could additionally check for if (y->a != NULL) if (array_size(D.1564.a) /= array_size(y->a)) run_time_error And for polymorphic arrays -- can this occur? if (y->a != NULL && BT_CLASS && y->a->vtab != D.a->vtab) run_time_error ----------------------------------------------- * * * The following is accepted by Cray, but at least "a = b" is invalid as those are coarrays. subroutine sub(x,y) implicit none type t integer :: i end type t type t2 class(t), allocatable :: A[:] end type t2 type(t2):: x, y class(t), allocatable :: a[:],b[:] x = y ! OK - or invalid? a = b ! invalid! end "7.2.1.2 Intrinsic assignment statement [...] (1) if the variable is polymorphic it shall be allocatable and not a coarray, [...] (3) the variable and expr shall be conformable unless the variable is an allocatable array that has the same rank as expr and is neither a coarray nor a coindexed object," ... and ... "An intrinsic assignment where the variable is of derived type is performed as if each component of the variable were assigned from the corresponding component of expr using pointer assignment (7.2.2) for each pointer component, defined assignment for each nonpointer nonallocatable component of a type that has a type-bound defined assignment consistent with the component, intrinsic assignment for each other nonpointer nonallocatable component, and intrinsic assignment for each allocated coarray component. For unallocated coarray components, the corresponding component of the variable shall be unallocated. For a noncoarray allocatable component the following sequence of operations is applied." Thus, the "intrinsic assignment for each allocated coarray component" rejects polymorphic coarray components. --------------------------- * Several issues when confusing coarrays with attr.codimension and coindexed. Deploy new gfc_is_coarray() function, fix fall out and add some more test cases Check, e.g., trans*.c Maybe already fixed - need to check for remaining items. * BUGS: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45859 -> [Coarray, F2008, IR] Rejects valid actuals to coarray dummies http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43412 -> BT_CLASS does not does not set array spec http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46371 Bug 46371 - [Coarray] [OOP] SELECT TYPE: scalar coarray variable is rejected [draft patch available] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49108 -> CAF registering: constructor tied to a var (req. ME support) * Fixes to allocatable coarray components. -- see also above -- FIXME: Find out what: a = t() or a = b is doing with regards to the coarray. Answer: (7.2.1.3, para. 13): "intrinsic assignment for each allocated coarray component. For unallocated coarray components, the corresponding component of the variable shall be unallocated." Thus, the deallocate/allocate for the component should be removed and a check (-fcheck=...) for same allocatation status - possibly also: Same array size - has to be added. * Check corank check for allocatable coarrays + dummy proc check (PR 48959) * Polymorphics coarrays * -fcoarray=lib: LOCK/UNLOCK * Remove CRITICAL from the library; it is wrongly implemented and can be better done using LOCK/UNLOCK (maybe also a special version of it, where the lock variable is only on one image). Mostly done. TODO: front-end part + final libcaf.h removal * Implement CRITICAL via LOCK (library version) * Implement ATOMIC (library version) * Check "const"ness of the pointer arguments of libcaf - especially in the FE; might also affect other functions in the library. (missed optimization issue) * IMAGE_INDEX with out-of-cobounds SUB Change gfc_error to gfc_warning; cf. http://gcc.gnu.org/ml/fortran/2011-04/msg00173.html http://gcc.gnu.org/ml/fortran/2011-04/msg00185.html * IMAGE INDEX: Run-time check for size(SUB) == corank. * Check when one should call __sync_synchronize() - in the FE - and when in the library? Never? For SYNC MEMORY? For all synchronization points? Cf. http://gcc.gnu.org/ml/fortran/2011-04/msg00162.html * Update gfortran.texi (F2008 section) as more than -fcoarray=single is implemented. Move additionally parts from the wiki to the texi: . http://gcc.gnu.org/wiki/Coarray . http://gcc.gnu.org/wiki/CoarrayLib . http://gcc.gnu.org/wiki/CoarrayExample * Document how the FE handles coarrays internally (argument passing etc.) * Add support for -fcoarray=lib in the test suite for MPI (-lcaf_single is already supported) For MPI via environment variables and/or site.expr to specify the compile/link options for MPI and the run command. * Add configure/build support for libgfortran/caf: Think about building libcaf_mpi.a * Fix array passing for coarrays, cf. PR 43931. That is: - fix bounds for coarray dummies by copying the descriptor if the corank does not match or if the cobounds are different; handle it for assumed-shape coarrays at the same place where the lower bound is set to 1, cf. gfc_trans_dummy_array_bias - Passing coarrays to a non-coarray dummy: Copy the descriptor as the type does not mach using: struct DescriptorRank * {ref-all} tmparray = (struct DescriptorRankCorank * {ref-all}) &coarray; foo (tmparray); Same {ref-all} issue occurs with assumed-shape dummy coarrays. * -fcoarray=lib: atomic_define/atomic_ref cf. also http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html * Add bounds checking of coindices Accessing invalid image/cobounds values, but also including checking for zero-bounds in allocate & variable declaration (invalid, cf. 6.7.1.2, paragraph 4 and 5.3.6.3, paragraph 4) [Don't forget SYNC IMAGES(...)] For IMAGE_INDEX add a size()==corank check. * Add more constraint tests after PR 43412 has been fixed. Preliminary test case: http://users.physik.fu-berlin.de/~tburnus/coarray/new/coarray_13.f90 Polymorphism problem report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43412 cf. also comments in http://gcc.gnu.org/ml/fortran/2010-04/msg00055.html * Fix other library issues. Remember to set nothrow correctly for function calls, cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43837 * Add MPI support to the test suite * Add helper process to MPI implementation * After everything works: Add shared-memory coarray support :-)