mirror of git://gcc.gnu.org/git/gcc.git
re PR fortran/28923 (Bad triplet interpretation in initialization)
2006-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/28923 expr.c (find_array_section): Only use the array lower and upper bounds for the start and end of the sections, where the expr is NULL. 2006-09-10 Paul Thomas <pault@gcc.gnu.org> PR libfortran/28923 gfortran.dg/array_initializer_2.f90: Fill in missing index start value. gfortran.dg/array_initializer_3.f90: New test. From-SVN: r116815
This commit is contained in:
parent
a7819e426a
commit
c71d6a561e
|
|
@ -1,4 +1,11 @@
|
||||||
2006-09-09 Paul Thomas <pault@gcc.gnu.org>
|
2006-09-10 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR fortran/28923
|
||||||
|
expr.c (find_array_section): Only use the array lower and upper
|
||||||
|
bounds for the start and end of the sections, where the expr is
|
||||||
|
NULL.
|
||||||
|
|
||||||
|
2006-09-10 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/28914
|
PR fortran/28914
|
||||||
* trans-array.c (gfc_trans_array_constructor_value): Create a temporary
|
* trans-array.c (gfc_trans_array_constructor_value): Create a temporary
|
||||||
|
|
|
||||||
|
|
@ -1090,24 +1090,15 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
|
||||||
if (begin)
|
if (begin)
|
||||||
mpz_set (start[d], begin->value.integer);
|
mpz_set (start[d], begin->value.integer);
|
||||||
else
|
else
|
||||||
{
|
mpz_set (start[d], lower->value.integer);
|
||||||
if (mpz_cmp_si (stride[d], 0) < 0)
|
|
||||||
mpz_set (start[d], upper->value.integer);
|
|
||||||
else
|
|
||||||
mpz_set (start[d], lower->value.integer);
|
|
||||||
}
|
|
||||||
mpz_set (ctr[d], start[d]);
|
mpz_set (ctr[d], start[d]);
|
||||||
|
|
||||||
/* Obtain the end value for the index. */
|
/* Obtain the end value for the index. */
|
||||||
if (finish)
|
if (finish)
|
||||||
mpz_set (end[d], finish->value.integer);
|
mpz_set (end[d], finish->value.integer);
|
||||||
else
|
else
|
||||||
{
|
mpz_set (end[d], upper->value.integer);
|
||||||
if (mpz_cmp_si (stride[d], 0) < 0)
|
|
||||||
mpz_set (end[d], lower->value.integer);
|
|
||||||
else
|
|
||||||
mpz_set (end[d], upper->value.integer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Separate 'if' because elements sometimes arrive with
|
/* Separate 'if' because elements sometimes arrive with
|
||||||
non-null end. */
|
non-null end. */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
2006-09-09 Paul Thomas <pault@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR libfortran/28923
|
||||||
|
gfortran.dg/array_initializer_2.f90: Fill in missing index start value.
|
||||||
|
gfortran.dg/array_initializer_3.f90: New test.
|
||||||
|
|
||||||
2006-09-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
2006-09-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
PR fortran/28914
|
PR fortran/28914
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
integer, dimension(3), parameter :: a=(/1,2,3/)
|
integer, dimension(3), parameter :: a=(/1,2,3/)
|
||||||
integer, dimension(3), parameter :: b=(/a(:)/)
|
integer, dimension(3), parameter :: b=(/a(:)/)
|
||||||
integer, dimension(3,3), parameter :: c=reshape ((/(i, i = 1,9)/),(/3,3/))
|
integer, dimension(3,3), parameter :: c=reshape ((/(i, i = 1,9)/),(/3,3/))
|
||||||
integer, dimension(2,3), parameter :: d=reshape ((/c(:2:-1,:)/),(/2,3/))
|
integer, dimension(2,3), parameter :: d=reshape ((/c(3:2:-1,:)/),(/2,3/))
|
||||||
integer, dimension(3,3), parameter :: e=reshape ((/a(:),a(:)+3,a(:)+6/),(/3,3/))
|
integer, dimension(3,3), parameter :: e=reshape ((/a(:),a(:)+3,a(:)+6/),(/3,3/))
|
||||||
integer, dimension(2,3), parameter :: f=reshape ((/c(2:1:-1,:)/),(/2,3/))
|
integer, dimension(2,3), parameter :: f=reshape ((/c(2:1:-1,:)/),(/2,3/))
|
||||||
if (any (b .ne. (/1,2,3/))) call abort ()
|
if (any (b .ne. (/1,2,3/))) call abort ()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
! { dg-do compile }
|
||||||
|
! Tests the fix for PR28923 in which initializer array constructors with
|
||||||
|
! a missing initial array index and negative stride would be incorrectly
|
||||||
|
! interpreted.
|
||||||
|
!
|
||||||
|
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
|
||||||
|
!
|
||||||
|
real, dimension(3,3), parameter :: a=reshape ((/(i, i = 1,9)/),(/3,3/))
|
||||||
|
real, dimension(2,3) :: b=a(:2:-1,:) ! { dg-error "different shape for Array assignment" }
|
||||||
|
real, dimension(2,3) :: c=a(3:2:-1,:)
|
||||||
|
print *, b
|
||||||
|
print *, c
|
||||||
|
end
|
||||||
|
|
||||||
Loading…
Reference in New Issue