Hi, I just committed the patch below as obvious to fix a 9/10 regression when directly calling BLAS routines for matmul. Will backport to gcc-9 soon.
Regards Thomas Commit symbol for external BLAS routine when translating MATMUL to *GEMM. 2019-11-09 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/92321 * frontend-passes.c (call_external_blas): Commit symbol for external BLAS routine. 2019-11-09 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/92321 * gfortran.dg/matmul_blas_2.f90: New test.
! { dg-do compile } ! { dg-options "-O3 -fdump-tree-original -fexternal-blas" } ! PR fortran/92321 - this used to cause an ICE. Original test case ! by Nathan Wukie. module mod_badmatmul implicit none contains subroutine test(c) real, intent(inout) :: c(3,3) real :: a(3,3), b(3,3) c = matmul(a, b) end subroutine test end module mod_badmatmul program main use mod_badmatmul, only: test implicit none real :: a(3,3) call test(a) end program main
Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 277999) +++ frontend-passes.c (Arbeitskopie) @@ -4635,6 +4635,7 @@ call_external_blas (gfc_code **c, int *walk_subtre call->symtree->n.sym->attr.procedure = 1; call->symtree->n.sym->attr.flavor = FL_PROCEDURE; call->resolved_sym = call->symtree->n.sym; + gfc_commit_symbol (call->resolved_sym); /* Argument TRANSA. */ next = gfc_get_actual_arglist ();