Commit 27696218 by Thomas Koenig

re PR fortran/36670 (Missing compile-time checks on sum and product)

2008-07-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/36670
	* iresolve.c (gfc_resolve_product):  Set shape of return
	value from array.
	(gfc_resolve_sum):  Likewise.

2008-07-07  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/36670
	* gfortran.dg/product_sum_bounds_1.f90:  New test case.

From-SVN: r137595
parent 9ad13e91
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36670
* iresolve.c (gfc_resolve_product): Set shape of return
value from array.
(gfc_resolve_sum): Likewise.
2008-07-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/36726
......
......@@ -1788,6 +1788,7 @@ gfc_resolve_product (gfc_expr *f, gfc_expr *array, gfc_expr *dim,
if (dim != NULL)
{
f->rank = array->rank - 1;
f->shape = gfc_copy_shape_excluding (array->shape, array->rank, dim);
gfc_resolve_dim_arg (dim);
}
......@@ -2271,6 +2272,7 @@ gfc_resolve_sum (gfc_expr *f, gfc_expr *array, gfc_expr *dim, gfc_expr *mask)
if (dim != NULL)
{
f->rank = array->rank - 1;
f->shape = gfc_copy_shape_excluding (array->shape, array->rank, dim);
gfc_resolve_dim_arg (dim);
}
......
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36670
* gfortran.dg/product_sum_bounds_1.f90: New test case.
2008-07-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36341
PR fortran/34670
* gfortran.dg/matmul_bounds_2.f90: New test.
......
! { dg-do compile }
program main
real, dimension(4,3) :: a
real, dimension(2) :: b
a = 21.
b = product(a,dim=1) ! { dg-error "Different shape" }
b = sum(a,dim=2) ! { dg-error "Different shape" }
end program main
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