From cb6138974f0d2929a63bf3f681c5d758530f3ed5 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Fri, 1 Sep 2023 11:58:23 +0200
Subject: [PATCH] coreblas: Fix corner case in diagonal kernel

---
 coreblas/compute/core_zgetrf_panel.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/coreblas/compute/core_zgetrf_panel.c b/coreblas/compute/core_zgetrf_panel.c
index 68911699b..f3467b1a3 100644
--- a/coreblas/compute/core_zgetrf_panel.c
+++ b/coreblas/compute/core_zgetrf_panel.c
@@ -134,13 +134,7 @@ CORE_zgetrf_panel_diag( int m, int n, int h, int m0,
             cblas_zscal( m-h, CBLAS_SADDR( alpha ), L, 1 );
         }
 
-        /*
-         * h is compared only to n, because if we are on the last column of a
-         * tile, m might be much smaller than n, and still we need to apply
-         * the geru call. If this is the diagonal tile, we will just look for
-         * the next maximum for nothing.
-         */
-        if ( h < n ) {
+        if ( h < chameleon_min( m, n ) ) {
             /* Applying the update */
             cblas_zgeru(CblasColMajor, m-h, n-h,
                         CBLAS_SADDR(mzone),
-- 
GitLab