This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran] PR 36825 - Revert rank 7 -> 15 patch
- From: Tobias Burnus <burnus at net-b dot de>
- To: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 16 Aug 2008 16:25:31 +0200
- Subject: [Patch, Fortran] PR 36825 - Revert rank 7 -> 15 patch
Hi all,
three months ago I changed GFC_MAX_DIMENSIONS to 15 to allow for 15-rank
arrays to be compatible with Fortran 2008. However, I missed that DTYPE
also contains the rank information. Unfortunately (see also PR) one can
not simply increase GFC_DTYPE_RANK_MASK as DTYPE contains the
information in a packed form, i.e. GFC_DTYPE_TYPE_SHIFT needs to be
increased from 3 to 4. That will change the libgfortran ABI (unless one
copies around a hundred functions).
Thomas suggested to break the ABI but wait for the next version, where
one can combine it with changes to the struct used to pass arrays. A
good draft for such a structure can be found in the "Further
interoperability with C" TR which is currently being created. If one
bases the implementation on that draft, one can implement the C interop
<-> fortran internal conversion functions a noop. (And the prosed
structure in the TR draft also looks sensible.)
Well, here is a patch which goes back to rank 7 support.
Build and test-suite checked on x86-64-linux.
OK for the trunk?
Tobias
2008-08-16 Tobias Burnus <burnus@net-b.de>
PR fortran/36825
* libgfortran.h: Reduce GFC_MAX_DIMENSIONS to 7.
2008-08-16 Tobias Burnus <burnus@net-b.de>
PR fortran/36825
* gfortran.dg/rank_1.f90: Modify error message.
Index: gcc/fortran/libgfortran.h
===================================================================
--- gcc/fortran/libgfortran.h (Revision 139150)
+++ gcc/fortran/libgfortran.h (Arbeitskopie)
@@ -88,7 +88,9 @@ libgfortran_error_codes;
#define GFC_STDERR_UNIT_NUMBER 0
-#define GFC_MAX_DIMENSIONS 15
+/* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
+ GFC_DTYPE_RANK_MASK. See PR 36825. */
+#define GFC_MAX_DIMENSIONS 7
#define GFC_DTYPE_RANK_MASK 0x07
#define GFC_DTYPE_TYPE_SHIFT 3
Index: gcc/testsuite/gfortran.dg/rank_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/rank_1.f90 (Revision 139150)
+++ gcc/testsuite/gfortran.dg/rank_1.f90 (Arbeitskopie)
@@ -4,6 +4,7 @@
! Fortran < 2008 allows 7 dimensions
! Fortran 2008 allows 15 dimensions (including co-array ranks)
!
-integer :: a(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
-integer :: b(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ! { dg-error "has more than 15 dimensions" }
+! FIXME: Rank patch was reverted because of PR 36825.
+integer :: a(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ! { dg-error "has more than 7 dimensions" }
+integer :: b(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ! { dg-error "has more than 7 dimensions" }
end