clang 11 fails to compile the static assertion as it cannot compute
the pointer value at a compile time:
gdb/sim/d10v/interp.c:1149:37: error: static_assert expression is not an integral constant expression
static_assert ((uintptr_t) &State == (uintptr_t) &State.regs,
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Instead, assert that the offset of State.regs is 0.
sim/d10v/ChangeLog:
* interp.c (sim_create_inferior): Use offsetof in static
assertion.
+2021-05-22 John Baldwin <jhb@FreeBSD.org>
+
+ * interp.c (sim_create_inferior): Use offsetof in static
+ assertion.
+
2021-05-17 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (SIM_HAVE_COMMON_SIM_STATE): Delete.
bfd_vma start_address;
/* Make sure we have the right structure for the following memset. */
- static_assert ((uintptr_t) &State == (uintptr_t) &State.regs,
- "&State != &State.regs");
+ static_assert (offsetof (struct _state, regs) == 0,
+ "State.regs is not at offset 0");
/* Reset state from the regs field until the mem field. */
memset (&State, 0, (uintptr_t) &State.mem - (uintptr_t) &State.regs);