Commit 8de1f441 by Jakub Jelinek Committed by Jakub Jelinek

re PR fortran/15080 (Forall bounds not calculated correctly (forall_3.f90))

	PR fortran/15080
	* trans-stmt.c (generate_loop_for_temp_to_lhs): Remove SIZE and COUNT2
	arguments.  If LSS is gfc_ss_terminator, increment COUNT1 by 1, instead
	of incrementing COUNT2 and using COUNT1+COUNT2 increment COUNT1 and use
	just that as index.
	(generate_loop_for_rhs_to_temp): Likewise.
	(compute_overall_iter_number): Add INNER_SIZE_BODY argument.
	It non-NULL, add it to body.
	(allocate_temp_for_forall_nest_1): New function, split from
	allocate_temp_for_forall_nest.
	(allocate_temp_for_forall_nest): Add INNER_SIZE_BODY argument,
	propagate it down to compute_overall_iter_number.  Use
	allocate_temp_for_forall_nest_1.
	(gfc_trans_assign_need_temp): Remove COUNT2.  Call
	compute_inner_temp_size into a new stmtblock_t.  Adjust calls to
	allocate_temp_for_forall_nest, generate_loop_for_rhs_to_temp
	and generate_loop_for_temp_to_lhs.
	(gfc_trans_pointer_assign_need_temp): Adjust calls to
	allocate_temp_for_forall_nest.
	(gfc_evaluate_where_mask): Call compute_inner_temp_size into a new
	stmtblock_t.  Call compute_overall_iter_number just once, then
	allocate_temp_for_forall_nest_1 twice with the same size.
	Initialize mask indexes if nested_forall_info != NULL.
	(gfc_trans_where_2): Initialize mask indexes before calling
	gfc_trans_nested_forall_loop.

	* gfortran.fortran-torture/execute/forall_3.f90: Remove comment
	about the test failing.
	* gfortran.fortran-torture/execute/where_7.f90: New test.
	* gfortran.fortran-torture/execute/where_8.f90: New test.

From-SVN: r99812
parent 2b5bf0e2
2005-05-17 Jakub Jelinek <jakub@redhat.com>
PR fortran/15080
* trans-stmt.c (generate_loop_for_temp_to_lhs): Remove SIZE and COUNT2
arguments. If LSS is gfc_ss_terminator, increment COUNT1 by 1, instead
of incrementing COUNT2 and using COUNT1+COUNT2 increment COUNT1 and use
just that as index.
(generate_loop_for_rhs_to_temp): Likewise.
(compute_overall_iter_number): Add INNER_SIZE_BODY argument.
It non-NULL, add it to body.
(allocate_temp_for_forall_nest_1): New function, split from
allocate_temp_for_forall_nest.
(allocate_temp_for_forall_nest): Add INNER_SIZE_BODY argument,
propagate it down to compute_overall_iter_number. Use
allocate_temp_for_forall_nest_1.
(gfc_trans_assign_need_temp): Remove COUNT2. Call
compute_inner_temp_size into a new stmtblock_t. Adjust calls to
allocate_temp_for_forall_nest, generate_loop_for_rhs_to_temp
and generate_loop_for_temp_to_lhs.
(gfc_trans_pointer_assign_need_temp): Adjust calls to
allocate_temp_for_forall_nest.
(gfc_evaluate_where_mask): Call compute_inner_temp_size into a new
stmtblock_t. Call compute_overall_iter_number just once, then
allocate_temp_for_forall_nest_1 twice with the same size.
Initialize mask indexes if nested_forall_info != NULL.
(gfc_trans_where_2): Initialize mask indexes before calling
gfc_trans_nested_forall_loop.
2005-05-15 Feng Wang <fengwang@nudt.edu.cn>
Jerry DeLisle <jvdelisle@verizon.net>
......
2005-05-17 Jakub Jelinek <jakub@redhat.com>
PR fortran/15080
* gfortran.fortran-torture/execute/forall_3.f90: Remove comment
about the test failing.
* gfortran.fortran-torture/execute/where_7.f90: New test.
* gfortran.fortran-torture/execute/where_8.f90: New test.
2005-05-16 Richard Henderson <rth@redhat.com>
* lib/target-supports.exp (check_effective_target_vect_int_mul): Add
......
! PR fortran/15080
! Really test forall with temporary
! This test fails (2004-06-28). See PR15080. I'd XFAIL it,
! but there doesn't seem to be an easy way to do this for torture tests.
program evil_forall
implicit none
type t
......
! Really test where inside forall with temporary
program evil_where
implicit none
type t
logical valid
integer :: s
integer, dimension(:), pointer :: p
end type
type (t), dimension (5) :: v
integer i
allocate (v(1)%p(2))
allocate (v(2)%p(8))
v(3)%p => NULL()
allocate (v(4)%p(8))
allocate (v(5)%p(2))
v(:)%valid = (/.true., .true., .false., .true., .true./)
v(:)%s = (/1, 8, 999, 6, 2/)
v(1)%p(:) = (/9, 10/)
v(2)%p(:) = (/1, 2, 3, 4, 5, 6, 7, 8/)
v(4)%p(:) = (/13, 14, 15, 16, 17, 18, 19, 20/)
v(5)%p(:) = (/11, 12/)
forall (i=1:5,v(i)%valid)
where (v(i)%p(1:v(i)%s).gt.4)
v(i)%p(1:v(i)%s) = v(6-i)%p(1:v(i)%s)
end where
end forall
if (any(v(1)%p(:) .ne. (/11, 10/))) call abort
if (any(v(2)%p(:) .ne. (/1, 2, 3, 4, 17, 18, 19, 20/))) call abort
if (any(v(4)%p(:) .ne. (/1, 2, 3, 4, 5, 6, 19, 20/))) call abort
if (any(v(5)%p(:) .ne. (/9, 10/))) call abort
v(1)%p(:) = (/9, 10/)
v(2)%p(:) = (/1, 2, 3, 4, 5, 6, 7, 8/)
v(4)%p(:) = (/13, 14, 15, 16, 17, 18, 19, 20/)
v(5)%p(:) = (/11, 12/)
forall (i=1:5,v(i)%valid)
where (v(i)%p(1:v(i)%s).le.4)
v(i)%p(1:v(i)%s) = v(6-i)%p(1:v(i)%s)
end where
end forall
if (any(v(1)%p(:) .ne. (/9, 10/))) call abort
if (any(v(2)%p(:) .ne. (/13, 14, 15, 16, 5, 6, 7, 8/))) call abort
if (any(v(4)%p(:) .ne. (/13, 14, 15, 16, 17, 18, 19, 20/))) call abort
if (any(v(5)%p(:) .ne. (/11, 12/))) call abort
! I should really free the memory I've allocated.
end program
program where_8
implicit none
type t
logical valid
integer :: s
integer, dimension(8) :: p
end type
type (t), dimension (5) :: v
integer i
v(:)%valid = (/.true., .true., .false., .true., .true./)
v(:)%s = (/1, 8, 999, 6, 2/)
v(1)%p(:) = (/9, 10, 0, 0, 0, 0, 0, 0/)
v(2)%p(:) = (/1, 2, 3, 4, 5, 6, 7, 8/)
v(4)%p(:) = (/13, 14, 15, 16, 17, 18, 19, 20/)
v(5)%p(:) = (/11, 12, 0, 0, 0, 0, 0, 0/)
forall (i=1:5,v(i)%valid)
where (v(i)%p(1:v(i)%s).gt.4)
v(i)%p(1:v(i)%s) = 21
end where
end forall
if (any(v(1)%p(:) .ne. (/21, 10, 0, 0, 0, 0, 0, 0/))) call abort
if (any(v(2)%p(:) .ne. (/1, 2, 3, 4, 21, 21, 21, 21/))) call abort
if (any(v(4)%p(:) .ne. (/21, 21, 21, 21, 21, 21, 19, 20/))) call abort
if (any(v(5)%p(:) .ne. (/21, 21, 0, 0, 0, 0, 0, 0/))) call abort
end program
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment