From b95866093913f48801a0cd7be554d51196e09ba0 Mon Sep 17 00:00:00 2001 From: Ben Magistro Date: Wed, 20 Apr 2022 16:01:18 +0000 Subject: dring: fix offsetof undefined behavior In gcc 11 (maybe parts of 10) the identification of constant expressions changed[1]. This causes the line changed to be an error. There is additional discussion about the change here [2] with the revision being based on the code referenced [3] in the discussion. 1) https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=beb019d346b903c16b9fd349937de444b6a8b6c0 2) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95942 3) https://github.com/dolphin-emu/dolphin/commit/118b2a3580972972c42a492347287fc292add50b Signed-off-by: Ben Magistro Change-Id: Id9b0efdd8d9b351e6e6097375b7d9002dc1737c9 --- lib/libtle_dring/tle_dring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libtle_dring/tle_dring.h b/lib/libtle_dring/tle_dring.h index 6aac22a..51cb7b7 100644 --- a/lib/libtle_dring/tle_dring.h +++ b/lib/libtle_dring/tle_dring.h @@ -527,7 +527,7 @@ tle_drb_calc_size(uint32_t num) { size_t sz; - sz = offsetof(struct tle_drb, objs[num]); + sz = offsetof(struct tle_drb, objs) + (sizeof(void*) * num); return RTE_ALIGN_CEIL(sz, RTE_CACHE_LINE_SIZE); } -- cgit 1.2.3-korg