aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2008-06-29 19:06:06 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2008-06-29 19:06:06 +0000
commit986a8d11c7dc58e3fbe44aa6b6018a04cd0093b8 (patch)
tree9416e6dafab840d6567e990de213db8bceb34a6d /gcc/fortran/iresolve.c
parent082b0571b5243222c59703a96c2c4cb6e438bad8 (diff)
downloadgcc-986a8d11c7dc58e3fbe44aa6b6018a04cd0093b8.zip
gcc-986a8d11c7dc58e3fbe44aa6b6018a04cd0093b8.tar.gz
gcc-986a8d11c7dc58e3fbe44aa6b6018a04cd0093b8.tar.bz2
re PR fortran/36341 (MATMUL: Bounds check missing)
2008-06-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36341 * iresolve.c (gfc_resolve_matmul): Copy shapes from arguments. 2008-06-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36341 * gfortran.dg/matmul_bounds_1.f90: New test. From-SVN: r137255
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index acbf5be..a1e7622 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1341,6 +1341,34 @@ gfc_resolve_matmul (gfc_expr *f, gfc_expr *a, gfc_expr *b)
f->rank = (a->rank == 2 && b->rank == 2) ? 2 : 1;
+ if (a->rank == 2 && b->rank == 2)
+ {
+ if (a->shape && b->shape)
+ {
+ f->shape = gfc_get_shape (f->rank);
+ mpz_init_set (f->shape[0], a->shape[0]);
+ mpz_init_set (f->shape[1], b->shape[1]);
+ }
+ }
+ else if (a->rank == 1)
+ {
+ if (b->shape)
+ {
+ f->shape = gfc_get_shape (f->rank);
+ mpz_init_set (f->shape[0], b->shape[1]);
+ }
+ }
+ else
+ {
+ /* b->rank == 1 and a->rank == 2 here, all other cases have
+ been caught in check.c. */
+ if (a->shape)
+ {
+ f->shape = gfc_get_shape (f->rank);
+ mpz_init_set (f->shape[0], a->shape[0]);
+ }
+ }
+
f->value.function.name
= gfc_get_string (PREFIX ("matmul_%c%d"), gfc_type_letter (f->ts.type),
f->ts.kind);