re PR fortran/83900 (ICE in gfc_simplify_matmul, at fortran/simplify.c:4593)
2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83900 * simplify.c (gfc_simplify_matmul): Set return type correctly. 2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83900 * gfortran.dg/matmul_18.f90: New test. From-SVN: r256919
This commit is contained in:
parent
929b44113e
commit
f5240750b7
4 changed files with 35 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/83900
|
||||
* simplify.c (gfc_simplify_matmul): Set return type correctly.
|
||||
|
||||
2018-01-19 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/83900
|
||||
|
|
|
@ -4590,9 +4590,23 @@ gfc_simplify_matmul (gfc_expr *matrix_a, gfc_expr *matrix_b)
|
|||
|| !is_constant_array_expr (matrix_b))
|
||||
return NULL;
|
||||
|
||||
result = gfc_get_array_expr (matrix_a->ts.type,
|
||||
matrix_a->ts.kind,
|
||||
&matrix_a->where);
|
||||
/* MATMUL should do mixed-mode arithmetic. Set the result type. */
|
||||
if (matrix_a->ts.type != matrix_b->ts.type)
|
||||
{
|
||||
gfc_expr e;
|
||||
e.expr_type = EXPR_OP;
|
||||
gfc_clear_ts (&e.ts);
|
||||
e.value.op.op = INTRINSIC_NONE;
|
||||
e.value.op.op1 = matrix_a;
|
||||
e.value.op.op2 = matrix_b;
|
||||
gfc_type_convert_binary (&e, 1);
|
||||
result = gfc_get_array_expr (e.ts.type, e.ts.kind, &matrix_a->where);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = gfc_get_array_expr (matrix_a->ts.type, matrix_a->ts.kind,
|
||||
&matrix_a->where);
|
||||
}
|
||||
|
||||
if (matrix_a->rank == 1 && matrix_b->rank == 2)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2018-01-20 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/83900
|
||||
* gfortran.dg/matmul_18.f90: New test.
|
||||
|
||||
2018-01-20 Richard Sandiford <richard.sandiford@linaro.org>
|
||||
|
||||
PR tree-optimization/83940
|
||||
|
|
8
gcc/testsuite/gfortran.dg/matmul_18.f90
Normal file
8
gcc/testsuite/gfortran.dg/matmul_18.f90
Normal file
|
@ -0,0 +1,8 @@
|
|||
! { dg-do run }
|
||||
program p
|
||||
integer, parameter :: a(3,2) = 1
|
||||
real, parameter :: b(2,3) = 2
|
||||
real d(3,3)
|
||||
d = 4
|
||||
if (any(d /= matmul(a,b))) call abort
|
||||
end
|
Loading…
Add table
Reference in a new issue