diff options
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/array_constructor_5.f90 | 11 |
4 files changed, 22 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 129b763..8a33912 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2005-07-07 Feng Wang <fengwang@nudt.edu.cn> + + PR fortran/22327 + * trans-array.c (gfc_trans_array_constructor_value): Fix index of data. + 2005-07-07 Jakub Jelinek <jakub@redhat.com> * decl.c (gfc_match_entry): Allow ENTRY without parentheses diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 8e9a089..d54dff3 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -862,7 +862,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, gfc_add_expr_to_block (&body, tmp); *poffset = fold_build2 (PLUS_EXPR, gfc_array_index_type, - *poffset, bound); + *poffset, build_int_cst (NULL_TREE, n)); } if (!INTEGER_CST_P (*poffset)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 817f273..1cbe9d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-07-07 Feng Wang <fengwang@nudt.edu.cn> + + PR fortran/22327 + * gfortran.dg/array_constructor_5.f90: New test. + 2005-07-07 Jakub Jelinek <jakub@redhat.com> * gfortran.fortran-torture/execute/entry_9.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/array_constructor_5.f90 b/gcc/testsuite/gfortran.dg/array_constructor_5.f90 new file mode 100644 index 0000000..8b8f6b0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_constructor_5.f90 @@ -0,0 +1,11 @@ +! { dg-do run } +! PR22327 +program array_constructor + implicit none + integer :: a(6), i + i = 6 + a = (/ 1, 2, 3, 4, 5, i /) + do i = 1, 6 + if (a(i) /= i) call abort() + end do +end program array_constructor |