diff options
author | Tobias Burnus <burnus@gcc.gnu.org> | 2007-03-16 11:57:45 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-03-16 11:57:45 +0100 |
commit | 945a98a4b2deb725bdd3f93801a2eeb8e262cca0 (patch) | |
tree | 91abe22811a811a95816cc71f77c52bbf6e574d4 /gcc | |
parent | 7c62b943baf5ef56622033f55a8eb9458e3d18be (diff) | |
download | gcc-945a98a4b2deb725bdd3f93801a2eeb8e262cca0.zip gcc-945a98a4b2deb725bdd3f93801a2eeb8e262cca0.tar.gz gcc-945a98a4b2deb725bdd3f93801a2eeb8e262cca0.tar.bz2 |
[multiple changes]
2007-03-16 Paul Thomas <pault@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/31188
* expr.c (find_array_section): Allow
non-expression-constant variables.
2007-03-16 Tobias Burnus <burnus@net-b.de>
PR fortran/31188
* gfortran.dg/parameter_array_dummy.f90: New test.
From-SVN: r122987
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/expr.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/parameter_array_dummy.f90 | 21 |
2 files changed, 28 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 06f4d20..bf5b74d 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1063,7 +1063,13 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR) /* Vector subscript. */ { gcc_assert (begin); - gcc_assert (begin->expr_type == EXPR_ARRAY); + + if (begin->expr_type != EXPR_ARRAY) + { + t = FAILURE; + goto cleanup; + } + gcc_assert (begin->rank == 1); gcc_assert (begin->shape); diff --git a/gcc/testsuite/gfortran.dg/parameter_array_dummy.f90 b/gcc/testsuite/gfortran.dg/parameter_array_dummy.f90 new file mode 100644 index 0000000..2aa3ad8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/parameter_array_dummy.f90 @@ -0,0 +1,21 @@ +! { dg-do run} +! PR fortran/31188 +program foo_mod + implicit none + character (len=1), parameter :: letters(2) = (/"a","b"/) + call concat(1, [1]) + call concat(2, [2]) + call concat(3, [1,2]) + call concat(4, [2,1]) + call concat(5, [2,2,2]) +contains + subroutine concat(i, ivec) + integer, intent(in) :: i, ivec(:) + write (*,*) i, "a" // letters(ivec) + end subroutine concat +end program foo_mod +! { dg-output "1 aa" } +! { dg-output "2 ab" } +! { dg-output "3 aaab" } +! { dg-output "4 abaa" } +! { dg-output "5 ababab" } |