summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-07 19:45:55 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-07 19:45:55 +0000
commit04ccfa1a5dbd37766264c5776999ae6f79589d2c (patch)
tree9f92fb2fe16307444d21c0a7e5e85af8d0429702
parent8dbe504b20208e69b1d67a4a3037329a7e580d42 (diff)
downloadgcc-04ccfa1a5dbd37766264c5776999ae6f79589d2c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137595 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/iresolve.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/product_sum_bounds_1.f908
4 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0369a0f3483..44f61fa2458 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+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
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 64a24e80007..2c804143ba9 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -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);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 143f75db13d..97f1e9bf60c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
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.
diff --git a/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90 b/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90
new file mode 100644
index 00000000000..c6390896c17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/product_sum_bounds_1.f90
@@ -0,0 +1,8 @@
+! { 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