From 9992c04bba629eccd44905b4db102436727a779d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 29 Sep 2022 17:29:41 +0200 Subject: [PATCH] Use std::fill instead of memset. It's a bit more C++'ish, and it seems to help to workaround what looks like an optimization bug in IntelLLVM 2022.2.0 (xbt::dict unit tests are failing). --- src/xbt/dict.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xbt/dict.cpp b/src/xbt/dict.cpp index 280d047537..6573bb88ed 100644 --- a/src/xbt/dict.cpp +++ b/src/xbt/dict.cpp @@ -15,6 +15,7 @@ #include "xbt/string.hpp" #include "xbt/xbt_modinter.h" +#include #include #include @@ -90,7 +91,7 @@ static void xbt_dict_rehash(xbt_dict_t dict) unsigned newsize = oldsize * 2; auto* newtable = static_cast(xbt_realloc(dict->table, newsize * sizeof(xbt_dictelm_t))); - memset(&newtable[oldsize], 0, oldsize * sizeof(xbt_dictelm_t)); /* zero second half */ + std::fill(newtable + oldsize, newtable + newsize, nullptr); /* zero second half */ newsize--; dict->table_size = newsize; dict->table = newtable; -- 2.20.1