aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Magistro <koncept1@gmail.com>2022-04-20 16:01:18 +0000
committerBen Magistro <koncept1@gmail.com>2022-04-20 16:12:10 +0000
commitb95866093913f48801a0cd7be554d51196e09ba0 (patch)
tree98fe4386db19bb5fee4e4926c75860e378259534
parentfef6f51d19e390757db6007127878d56a17c4e24 (diff)
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 <koncept1@gmail.com> Change-Id: Id9b0efdd8d9b351e6e6097375b7d9002dc1737c9
-rw-r--r--lib/libtle_dring/tle_dring.h2
1 files changed, 1 insertions, 1 deletions
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);
}