From a51a74ed013d26f416b4a4aefbe037bd54ddd04c Mon Sep 17 00:00:00 2001
From: Guillaume Sylvand <guillaume.sylvand@airbus.com>
Date: Thu, 13 Oct 2016 07:42:22 +0000
Subject: [PATCH] The largest value handled with a given number of bits must
 include a '-1'

---
 runtime/starpu/control/runtime_descriptor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c
index 625c397de..a0a95469f 100644
--- a/runtime/starpu/control/runtime_descriptor.c
+++ b/runtime/starpu/control/runtime_descriptor.c
@@ -123,7 +123,7 @@ void RUNTIME_desc_create( MORSE_desc_t *desc )
                 morse_error("RUNTIME_desc_create", "MPI_TAG_UB not known by MPI");
             }
 
-            while ( ((uintptr_t)(1UL<<tag_width) > (uint)(*tag_ub) )
+            while ( ((uintptr_t)(1UL<<tag_width - 1) > (uint)(*tag_ub) )
                     && (tag_width >= TAG_WIDTH_MIN) ) {
                 tag_width--;
                 tag_sep--;
-- 
GitLab