diff --git a/repos/base/include/util/string.h b/repos/base/include/util/string.h index 6d2aee5f37..5e41b53d76 100644 --- a/repos/base/include/util/string.h +++ b/repos/base/include/util/string.h @@ -221,7 +221,12 @@ namespace Genode { * \param dst destination buffer * \param i byte value * \param size buffer size in bytes + * + * The compiler attribute is needed to prevent the + * generation of a 'memset()' call in the 'while' loop + * with gcc 10. */ + __attribute((optimize("no-tree-loop-distribute-patterns"))) inline void *memset(void *dst, int i, size_t size) { while (size--) ((char *)dst)[size] = i; diff --git a/repos/dde_rump/lib/mk/rump.inc b/repos/dde_rump/lib/mk/rump.inc index fc55936f66..d2bdb9ad12 100644 --- a/repos/dde_rump/lib/mk/rump.inc +++ b/repos/dde_rump/lib/mk/rump.inc @@ -196,6 +196,9 @@ SRC_NOLINK += accessors.c \ vnode_if.c \ xlat_mbr_fstype.c +# prevent the generation of a 'memset()' call in 'memset()' +CC_OPT_memset = -fno-tree-loop-distribute-patterns + INC_DIR += $(REP_DIR)/src/include \ $(RUMP_BASE)/include \ $(RUMP_PORT_DIR)/src/lib/libc/include \ diff --git a/repos/libports/lib/mk/libc-string.mk b/repos/libports/lib/mk/libc-string.mk index e634d35060..74128c27bf 100644 --- a/repos/libports/lib/mk/libc-string.mk +++ b/repos/libports/lib/mk/libc-string.mk @@ -13,6 +13,9 @@ LIBC_STRING_DIR = $(LIBC_DIR)/lib/libc/string SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(LIBC_STRING_DIR)/*.c))) +# prevent the generation of a 'memset()' call in 'memset()' +CC_OPT_memset += -fno-tree-loop-distribute-patterns + include $(REP_DIR)/lib/mk/libc-common.inc vpath %.c $(LIBC_STRING_DIR)