[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] trace: fix build with gcc9



>>> George Dunlap <george.dunlap@xxxxxxxxxx> 03/07/19 1:02 PM >>>
>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?

With the __packed attribute, the compiler _could_ place the structure at
a misaligned slot on the stack. It has got nothing to do with struct layout
afaict. Note how the diagnostic says "may", not "does".


Jan


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.