-
Notifications
You must be signed in to change notification settings - Fork 42
Description
[jgunthorpe wrote:]
The reason you can't take the address of a packed member is because it is not aligned, it is simply an error and you shouldn't ever do it - it will crash at runtime on ARM. If the member is actually aligned then don't use packed, but use the proper attribute aligned to tell the compiler what is happening and it won't complain.
605osm_vendor_ibumad.c:409:41: error: taking address of packed member 'trans_id' of
606 class or structure '_ib_mad' may result in an unaligned pointer value
607 [-Werror,-Waddress-of-packed-member]
608 if (!(p_req_madw = get_madw(p_vend, &p_mad->trans_id,
609 ^~~~~~~~~~~~~~~
610osm_vendor_ibumad.c:437:35: error: taking address of packed member 'trans_id' of
611 class or structure '_ib_mad' may result in an unaligned pointer value
612 [-Werror,-Waddress-of-packed-member]
613 p_req_madw = get_madw(p_vend, &p_mad->trans_id,
614 ^~~~~~~~~~~~~~~
615osm_vendor_ibumad.c:1211:22: error: taking address of packed member 'trans_id'
616 of class or structure '_ib_mad' may result in an unaligned pointer value
617 [-Werror,-Waddress-of-packed-member]
618 get_madw(p_vend, &p_mad->trans_id,
619 ^~~~~~~~~~~~~~~
6203 errors generated.
The above occurred in libvendor/osm_vendor_ibumad.c where p_mad->trans_id was being accessed and p_mad is a pointer to ib_mad_t.
This is mainly issue in ib_types.h