From b03932cb99afb634786a8000e447fb21fad115d0 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sat, 9 Nov 2019 14:54:19 +0000 Subject: [PATCH] Commit symbol for external BLAS routine when translating MATMUL to *GEMM. 2019-11-09 Thomas Koenig PR fortran/92321 * frontend-passes.c (call_external_blas): Commit symbol for external BLAS routine. 2019-11-09 Thomas Koenig PR fortran/92321 * gfortran.dg/matmul_blas_2.f90: New test. From-SVN: r278003 --- gcc/fortran/ChangeLog | 6 +++++ gcc/fortran/frontend-passes.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/matmul_blas_2.f90 | 25 +++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/matmul_blas_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bf1f8cf3a70..449589ba65e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-11-09 Thomas Koenig + + PR fortran/92321 + * frontend-passes.c (call_external_blas): Commit symbol for + external BLAS routine. + 2019-11-08 Jakub Jelinek * arith.c (character2representation): Change i type to size_t. diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 87518b8b7d8..a20d9efa231 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -4635,6 +4635,7 @@ call_external_blas (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, 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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ae3ccfcfb6..0f8ef38320e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-09 Thomas Koenig + + PR fortran/92321 + * gfortran.dg/matmul_blas_2.f90: New test. + 2019-11-09 Jakub Jelinek * gfortran.dg/dec_char_conversion_in_assignment_4.f90: Use diff --git a/gcc/testsuite/gfortran.dg/matmul_blas_2.f90 b/gcc/testsuite/gfortran.dg/matmul_blas_2.f90 new file mode 100644 index 00000000000..237f4a10d89 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_blas_2.f90 @@ -0,0 +1,25 @@ +! { 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 -- 2.30.2