From a4cd1610eacd66049c22244a1d38e024d57af989 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 16 May 2008 23:05:08 +0200 Subject: [PATCH] libgfortran.h: Increase GFC_MAX_DIMENSIONS to 15. 2008-05-16 Tobias Burnus * libgfortran.h: Increase GFC_MAX_DIMENSIONS to 15. * array.c (gfc_match_array_spec): Error with -std=f2003 if rank > 7. 2008-05-16 Tobias Burnus * gfortran.dg/rank_1.f90 * gfortran.dg/rank_2.f90 From-SVN: r135442 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/array.c | 6 ++++++ gcc/fortran/libgfortran.h | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/rank_1.f90 | 9 +++++++++ gcc/testsuite/gfortran.dg/rank_2.f90 | 8 ++++++++ 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/rank_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/rank_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ef9f1cfe35c..bc62570a7e4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-05-16 Tobias Burnus + + * libgfortran.h: Increase GFC_MAX_DIMENSIONS to 15. + * array.c (gfc_match_array_spec): Error with -std=f2003 if rank > 7. + 2008-04-16 Daniel Kraft PR fortran/27997 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 71c8b5d669e..5593289a910 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -437,6 +437,12 @@ gfc_match_array_spec (gfc_array_spec **asp) goto cleanup; } + if (as->rank > 7 + && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Array " + "specification at %C with more than 7 dimensions") + == FAILURE) + goto cleanup; + as->rank++; } diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h index 513dbd228ab..ccae391aebb 100644 --- a/gcc/fortran/libgfortran.h +++ b/gcc/fortran/libgfortran.h @@ -88,7 +88,7 @@ libgfortran_error_codes; #define GFC_STDERR_UNIT_NUMBER 0 -#define GFC_MAX_DIMENSIONS 7 +#define GFC_MAX_DIMENSIONS 15 #define GFC_DTYPE_RANK_MASK 0x07 #define GFC_DTYPE_TYPE_SHIFT 3 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74fd3808909..9d1b7aa0208 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-16 Tobias Burnus + + * gfortran.dg/rank_1.f90 + * gfortran.dg/rank_2.f90 + 2008-05-16 Jerry DeLisle * gfortran.dg/missing_parens_1.f90: Update test. diff --git a/gcc/testsuite/gfortran.dg/rank_1.f90 b/gcc/testsuite/gfortran.dg/rank_1.f90 new file mode 100644 index 00000000000..3467faded2b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/rank_1.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } +! +! 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" } +end diff --git a/gcc/testsuite/gfortran.dg/rank_2.f90 b/gcc/testsuite/gfortran.dg/rank_2.f90 new file mode 100644 index 00000000000..b7d75dbeae4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/rank_2.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! +! 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) ! { dg-error "more than 7 dimensions" } +end -- 2.30.2