On 3/7/19 10:34 AM, Jan Beulich wrote:
> While I've not observed this myself, gcc 9 (imo validly) reportedly may
> complain
> 
> trace.c: In function '__trace_hypercall':
> trace.c:826:19: error: taking address of packed member of 'struct 
> <anonymous>' may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   826 |     uint32_t *a = d.args;

Wait, is this saying that in this case (i.e., with a single uint32_t
before args), you *do* get an unaligned pointer value, or just that if
the struct changes in the future that the pointer value may become
un-aligned?

If the latter, I disagree that the warning is valid.  If at some point
in the future, 'op' changes to be (say) 16 bits, then *that* is when the
compiler should complain; and that's when we can either add in our own
padding, or change the algorithm not to require a pointer to args[].

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to