This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR54463 - fix -fexternal-matmul with -fdefault-real-8


Rather obvious fix.

Build on x86-64-linux.
OK for the trunk when regtesting has succeeded?

Tobias
2012-09-06  Tobias Burnus

	PR fortran/54463
	* trans-intrinsic.c (gfc_conv_intrinsic_funcall): Fix matmul
	call to BLAS if the default-kind has been promoted.

2012-09-06  Tobias Burnus

	PR fortran/54463
	* gfortran.dg/promotion_2.f90: New.

diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index add4baa..4b268b3 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -2362,21 +2362,20 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
 
       if (gfc_option.flag_external_blas
 	  && (sym->ts.type == BT_REAL || sym->ts.type == BT_COMPLEX)
-	  && (sym->ts.kind == gfc_default_real_kind
-	      || sym->ts.kind == gfc_default_double_kind))
+	  && (sym->ts.kind == 4 || sym->ts.kind == 8))
 	{
 	  tree gemm_fndecl;
 
 	  if (sym->ts.type == BT_REAL)
 	    {
-	      if (sym->ts.kind == gfc_default_real_kind)
+	      if (sym->ts.kind == 4)
 		gemm_fndecl = gfor_fndecl_sgemm;
 	      else
 		gemm_fndecl = gfor_fndecl_dgemm;
 	    }
 	  else
 	    {
-	      if (sym->ts.kind == gfc_default_real_kind)
+	      if (sym->ts.kind == 4)
 		gemm_fndecl = gfor_fndecl_cgemm;
 	      else
 		gemm_fndecl = gfor_fndecl_zgemm;
--- /dev/null	2012-09-03 07:48:56.919718426 +0200
+++ gcc/gcc/testsuite/gfortran.dg/promotion_2.f90	2012-09-05 19:52:17.000000000 +0200
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-fdefault-real-8 -fexternal-blas -fdump-tree-original" }
+!
+! PR fortran/54463
+!
+! Contributed by Simon Reinhardt
+!
+program test
+  implicit none
+  real, dimension(3,3) :: A
+  A = matmul(A,A)
+end program test
+
+! { dg-final { scan-tree-dump-times "sgemm_" 0 "original" } }
+! { dg-final { scan-tree-dump-times "dgemm_" 1 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]